summaryrefslogtreecommitdiffstats
path: root/Modules/_struct.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-12-19 18:07:48 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-12-19 18:07:48 (GMT)
commitc06a6d0958e2eb4449605069b9c10d656ab756e8 (patch)
tree3be097cf344ed6c277ca77bd37f253f5c66d3a7d /Modules/_struct.c
parent6f3d5da36cb6f7a7472c69f92de16682e5a82620 (diff)
downloadcpython-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/_struct.c')
-rw-r--r--Modules/_struct.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c
index bca7a2e..02dd7d3 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1737,7 +1737,7 @@ s_sizeof(PyStructObject *self, void *unused)
{
Py_ssize_t size;
- size = sizeof(PyStructObject) + sizeof(formatcode) * (self->s_len + 1);
+ size = _PyObject_SIZE(Py_TYPE(self)) + sizeof(formatcode) * (self->s_len + 1);
return PyLong_FromSsize_t(size);
}