Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of dict.
diff --git a/Include/dictobject.h b/Include/dictobject.h
index 30f114e..885694b 100644
--- a/Include/dictobject.h
+++ b/Include/dictobject.h
@@ -106,6 +106,8 @@
 PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp);
 PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key);
 #ifndef Py_LIMITED_API
+/* Get the number of items of a dictionary. */
+#define PyDict_GET_SIZE(mp)  (assert(PyDict_Check(mp)),((PyDictObject *)mp)->ma_used)
 PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash);
 PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
 PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);