mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #24731: Fixed crash on converting objects with special methods
__bytes__, __trunc__, and __float__ returning instances of subclasses of bytes, int, and float to subclasses of bytes, int, and float correspondingly.
This commit is contained in:
parent
a49de6be36
commit
15095800a3
8 changed files with 50 additions and 10 deletions
|
@ -1567,7 +1567,7 @@ float_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
tmp = float_new(&PyFloat_Type, args, kwds);
|
||||
if (tmp == NULL)
|
||||
return NULL;
|
||||
assert(PyFloat_CheckExact(tmp));
|
||||
assert(PyFloat_Check(tmp));
|
||||
newobj = type->tp_alloc(type, 0);
|
||||
if (newobj == NULL) {
|
||||
Py_DECREF(tmp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue