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:47:01 +02:00
parent a49de6be36
commit 15095800a3
8 changed files with 50 additions and 10 deletions

View file

@ -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);