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:
Serhiy Storchaka 2015-11-25 15:52:04 +02:00
commit f9afda57ad
8 changed files with 50 additions and 10 deletions

View file

@ -1568,7 +1568,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);