diff --git a/mypyc/lib-rt/mypyc_util.h b/mypyc/lib-rt/mypyc_util.h index 80019d23bb06..64bf025aec27 100644 --- a/mypyc/lib-rt/mypyc_util.h +++ b/mypyc/lib-rt/mypyc_util.h @@ -31,6 +31,8 @@ // Here just for consistency #define CPy_XDECREF(p) Py_XDECREF(p) +#ifndef Py_GIL_DISABLED + // The *_NO_IMM operations below perform refcount manipulation for // non-immortal objects (Python 3.12 and later). // @@ -60,6 +62,14 @@ static inline void CPy_XDECREF_NO_IMM(PyObject *op) #define CPy_DECREF_NO_IMM(op) CPy_DECREF_NO_IMM((PyObject *)(op)) #define CPy_XDECREF_NO_IMM(op) CPy_XDECREF_NO_IMM((PyObject *)(op)) +#else + +#define CPy_INCREF_NO_IMM(op) CPy_INCREF(op) +#define CPy_DECREF_NO_IMM(op) CPy_DECREF(op) +#define CPy_XDECREF_NO_IMM(op) CPy_XDECREF(op) + +#endif + // Tagged integer -- our representation of Python 'int' objects. // Small enough integers are represented as unboxed integers (shifted // left by 1); larger integers (larger than 63 bits on a 64-bit