mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +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:
commit
f9afda57ad
8 changed files with 50 additions and 10 deletions
|
|
@ -4611,7 +4611,7 @@ long_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
tmp = (PyLongObject *)long_new(&PyLong_Type, args, kwds);
|
||||
if (tmp == NULL)
|
||||
return NULL;
|
||||
assert(PyLong_CheckExact(tmp));
|
||||
assert(PyLong_Check(tmp));
|
||||
n = Py_SIZE(tmp);
|
||||
if (n < 0)
|
||||
n = -n;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue