From 5c4064e8bd199d70eefd7ec24766957c22f1b8e8 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 19 Dec 2015 20:05:25 +0200 Subject: 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. --- Objects/codeobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Objects/codeobject.c') diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 353f414a38..b0e34468a7 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -384,7 +384,7 @@ code_sizeof(PyCodeObject *co, void *unused) { Py_ssize_t res; - res = sizeof(PyCodeObject); + res = _PyObject_SIZE(Py_TYPE(co)); if (co->co_cell2arg != NULL && co->co_cellvars != NULL) res += PyTuple_GET_SIZE(co->co_cellvars) * sizeof(unsigned char); return PyLong_FromSsize_t(res); -- cgit v1.2.1