Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of dict.
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 1d7a935..d621789 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -2048,7 +2048,7 @@
 
     s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL);
     if (s_object != NULL) {
-        if (PyDict_Size(cache) >= MAXCACHE)
+        if (PyDict_GET_SIZE(cache) >= MAXCACHE)
             PyDict_Clear(cache);
         /* Attempt to cache the result */
         if (PyDict_SetItem(cache, fmt, s_object) == -1)