mirror of
https://github.com/python/cpython.git
synced 2025-07-24 19:54:21 +00:00
Issue #23629: Fix the default __sizeof__ implementation for variable-sized objects.
This commit is contained in:
commit
63afdaa110
6 changed files with 22 additions and 52 deletions
|
@ -4276,7 +4276,7 @@ object_sizeof(PyObject *self, PyObject *args)
|
|||
res = 0;
|
||||
isize = self->ob_type->tp_itemsize;
|
||||
if (isize > 0)
|
||||
res = Py_SIZE(self->ob_type) * isize;
|
||||
res = Py_SIZE(self) * isize;
|
||||
res += self->ob_type->tp_basicsize;
|
||||
|
||||
return PyLong_FromSsize_t(res);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue