summaryrefslogtreecommitdiffstats
path: root/Include/cpython/code.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/cpython/code.h')
-rw-r--r--Include/cpython/code.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/Include/cpython/code.h b/Include/cpython/code.h
index ebac0b1..15b464f 100644
--- a/Include/cpython/code.h
+++ b/Include/cpython/code.h
@@ -147,7 +147,12 @@ struct PyCodeObject _PyCode_DEF(1);
PyAPI_DATA(PyTypeObject) PyCode_Type;
#define PyCode_Check(op) Py_IS_TYPE((op), &PyCode_Type)
-#define PyCode_GetNumFree(op) ((op)->co_nfreevars)
+
+static inline Py_ssize_t PyCode_GetNumFree(PyCodeObject *op) {
+ assert(PyCode_Check(op));
+ return op->co_nfreevars;
+}
+
#define _PyCode_CODE(CO) ((_Py_CODEUNIT *)(CO)->co_code_adaptive)
#define _PyCode_NBYTES(CO) (Py_SIZE(CO) * (Py_ssize_t)sizeof(_Py_CODEUNIT))