diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-19 18:07:48 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-19 18:07:48 (GMT) |
commit | c06a6d0958e2eb4449605069b9c10d656ab756e8 (patch) | |
tree | 3be097cf344ed6c277ca77bd37f253f5c66d3a7d /Modules/arraymodule.c | |
parent | 6f3d5da36cb6f7a7472c69f92de16682e5a82620 (diff) | |
download | cpython-c06a6d0958e2eb4449605069b9c10d656ab756e8.zip cpython-c06a6d0958e2eb4449605069b9c10d656ab756e8.tar.gz cpython-c06a6d0958e2eb4449605069b9c10d656ab756e8.tar.bz2 |
Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size.
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r-- | Modules/arraymodule.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 1d1f0d3..f147115 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1541,7 +1541,7 @@ static PyObject * array_sizeof(arrayobject *self, PyObject *unused) { Py_ssize_t res; - res = sizeof(arrayobject) + self->allocated * self->ob_descr->itemsize; + res = _PyObject_SIZE(Py_TYPE(self)) + self->allocated * self->ob_descr->itemsize; return PyLong_FromSsize_t(res); } |