There was an error while loading. Please reload this page.
1 parent b3f99b6 commit f9b67adCopy full SHA for f9b67ad
1 file changed
Include/cpython/dictobject.h
@@ -46,7 +46,15 @@ PyAPI_FUNC(int) _PyDict_Next(
46
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash);
47
48
/* Get the number of items of a dictionary. */
49
-#define PyDict_GET_SIZE(mp) (assert(PyDict_Check(mp)),((PyDictObject *)mp)->ma_used)
+static inline Py_ssize_t PyDict_GET_SIZE(PyObject *op) {
50
+ assert(PyDict_Check(op));
51
+ PyDictObject *mp = _Py_CAST(PyDictObject*, op);
52
+ return mp->ma_used;
53
+}
54
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030c0000
55
+# define PyDict_GET_SIZE(op) PyDict_GET_SIZE(_PyObject_CAST(op))
56
+#endif
57
+
58
PyAPI_FUNC(int) _PyDict_Contains_KnownHash(PyObject *, PyObject *, Py_hash_t);
59
PyAPI_FUNC(int) _PyDict_ContainsId(PyObject *, _Py_Identifier *);
60
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
0 commit comments