@@ -106,9 +106,9 @@ check by comparing the reference count field to the immortality reference count.
106106#define _Py_IMMORTAL_REFCNT (UINT_MAX >> 2)
107107#endif
108108
109- // Py_NOGIL builds indicate immortal objects using `ob_ref_local`, which is
109+ // Py_GIL_DISABLED builds indicate immortal objects using `ob_ref_local`, which is
110110// always 32-bits.
111- #ifdef Py_NOGIL
111+ #ifdef Py_GIL_DISABLED
112112#define _Py_IMMORTAL_REFCNT_LOCAL UINT32_MAX
113113#endif
114114
@@ -117,7 +117,7 @@ check by comparing the reference count field to the immortality reference count.
117117
118118// Make all internal uses of PyObject_HEAD_INIT immortal while preserving the
119119// C-API expectation that the refcnt will be set to 1.
120- #if defined(Py_NOGIL )
120+ #if defined(Py_GIL_DISABLED )
121121#define PyObject_HEAD_INIT (type ) \
122122 { \
123123 0, \
@@ -162,7 +162,7 @@ check by comparing the reference count field to the immortality reference count.
162162 * by hand. Similarly every pointer to a variable-size Python object can,
163163 * in addition, be cast to PyVarObject*.
164164 */
165- #ifndef Py_NOGIL
165+ #ifndef Py_GIL_DISABLED
166166struct _object {
167167#if (defined(__GNUC__ ) || defined(__clang__ )) \
168168 && !(defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L )
@@ -238,7 +238,7 @@ typedef struct {
238238PyAPI_FUNC (int ) Py_Is (PyObject * x , PyObject * y );
239239#define Py_Is (x , y ) ((x) == (y))
240240
241- #if defined(Py_NOGIL ) && !defined(Py_LIMITED_API )
241+ #if defined(Py_GIL_DISABLED ) && !defined(Py_LIMITED_API )
242242static inline uintptr_t
243243_Py_ThreadId (void )
244244{
@@ -275,7 +275,7 @@ _Py_IsOwnedByCurrentThread(PyObject *ob)
275275#endif
276276
277277static inline Py_ssize_t Py_REFCNT (PyObject * ob ) {
278- #if !defined(Py_NOGIL )
278+ #if !defined(Py_GIL_DISABLED )
279279 return ob -> ob_refcnt ;
280280#else
281281 uint32_t local = _Py_atomic_load_uint32_relaxed (& ob -> ob_ref_local );
@@ -316,7 +316,7 @@ static inline Py_ssize_t Py_SIZE(PyObject *ob) {
316316
317317static inline Py_ALWAYS_INLINE int _Py_IsImmortal (PyObject * op )
318318{
319- #if defined(Py_NOGIL )
319+ #if defined(Py_GIL_DISABLED )
320320 return op -> ob_ref_local == _Py_IMMORTAL_REFCNT_LOCAL ;
321321#elif SIZEOF_VOID_P > 4
322322 return _Py_CAST (PY_INT32_T , op -> ob_refcnt ) < 0 ;
@@ -350,7 +350,7 @@ static inline void Py_SET_REFCNT(PyObject *ob, Py_ssize_t refcnt) {
350350 if (_Py_IsImmortal (ob )) {
351351 return ;
352352 }
353- #ifndef Py_NOGIL
353+ #ifndef Py_GIL_DISABLED
354354 ob -> ob_refcnt = refcnt ;
355355#else
356356 if (_Py_IsOwnedByCurrentThread (ob )) {
@@ -367,7 +367,7 @@ static inline void Py_SET_REFCNT(PyObject *ob, Py_ssize_t refcnt) {
367367 ob -> ob_ref_local = 0 ;
368368 ob -> ob_ref_shared = _Py_REF_SHARED (refcnt , _Py_REF_MERGED );
369369 }
370- #endif // Py_NOGIL
370+ #endif // Py_GIL_DISABLED
371371#endif // Py_LIMITED_API+0 < 0x030d0000
372372}
373373#if !defined(Py_LIMITED_API ) || Py_LIMITED_API + 0 < 0x030b0000
@@ -746,7 +746,7 @@ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
746746#else
747747 // Non-limited C API and limited C API for Python 3.9 and older access
748748 // directly PyObject.ob_refcnt.
749- #if defined(Py_NOGIL )
749+ #if defined(Py_GIL_DISABLED )
750750 uint32_t local = _Py_atomic_load_uint32_relaxed (& op -> ob_ref_local );
751751 uint32_t new_local = local + 1 ;
752752 if (new_local == 0 ) {
@@ -784,7 +784,7 @@ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
784784#endif
785785
786786
787- #if !defined(Py_LIMITED_API ) && defined(Py_NOGIL )
787+ #if !defined(Py_LIMITED_API ) && defined(Py_GIL_DISABLED )
788788// Implements Py_DECREF on objects not owned by the current thread.
789789PyAPI_FUNC (void ) _Py_DecRefShared (PyObject * );
790790PyAPI_FUNC (void ) _Py_DecRefSharedDebug (PyObject * , const char * , int );
@@ -810,7 +810,7 @@ static inline void Py_DECREF(PyObject *op) {
810810}
811811#define Py_DECREF (op ) Py_DECREF(_PyObject_CAST(op))
812812
813- #elif defined(Py_NOGIL ) && defined(Py_REF_DEBUG )
813+ #elif defined(Py_GIL_DISABLED ) && defined(Py_REF_DEBUG )
814814static inline void Py_DECREF (const char * filename , int lineno , PyObject * op )
815815{
816816 uint32_t local = _Py_atomic_load_uint32_relaxed (& op -> ob_ref_local );
@@ -835,7 +835,7 @@ static inline void Py_DECREF(const char *filename, int lineno, PyObject *op)
835835}
836836#define Py_DECREF (op ) Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op))
837837
838- #elif defined(Py_NOGIL )
838+ #elif defined(Py_GIL_DISABLED )
839839static inline void Py_DECREF (PyObject * op )
840840{
841841 uint32_t local = _Py_atomic_load_uint32_relaxed (& op -> ob_ref_local );
0 commit comments