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.
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 5276da5..1fdd916 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -2780,7 +2780,7 @@
 {
     Py_ssize_t res;
 
-    res = sizeof(PyByteArrayObject) + self->ob_alloc * sizeof(char);
+    res = _PyObject_SIZE(Py_TYPE(self)) + self->ob_alloc * sizeof(char);
     return PyInt_FromSsize_t(res);
 }
 
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 50afa3f..b281948 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -2152,7 +2152,7 @@
 {
     Py_ssize_t res;
 
-    res = sizeof(PyDictObject);
+    res = _PyObject_SIZE(Py_TYPE(mp));
     if (mp->ma_table != mp->ma_smalltable)
         res = res + (mp->ma_mask + 1) * sizeof(PyDictEntry);
     return PyInt_FromSsize_t(res);
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 1f43ba2..27365b6 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2469,7 +2469,7 @@
 {
     Py_ssize_t res;
 
-    res = sizeof(PyListObject) + self->allocated * sizeof(void*);
+    res = _PyObject_SIZE(Py_TYPE(self)) + self->allocated * sizeof(void*);
     return PyInt_FromSsize_t(res);
 }
 
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 8a58d65..a9ebbec 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -1985,7 +1985,7 @@
 {
     Py_ssize_t res;
 
-    res = sizeof(PySetObject);
+    res = _PyObject_SIZE(Py_TYPE(so));
     if (so->table != so->smalltable)
         res = res + (so->mask + 1) * sizeof(setentry);
     return PyInt_FromSsize_t(res);