@@ -106,9 +106,9 @@ check by comparing the reference count field to the immortality reference count.
106
106
#define _Py_IMMORTAL_REFCNT (UINT_MAX >> 2)
107
107
#endif
108
108
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
110
110
// always 32-bits.
111
- #ifdef Py_NOGIL
111
+ #ifdef Py_GIL_DISABLED
112
112
#define _Py_IMMORTAL_REFCNT_LOCAL UINT32_MAX
113
113
#endif
114
114
@@ -117,7 +117,7 @@ check by comparing the reference count field to the immortality reference count.
117
117
118
118
// Make all internal uses of PyObject_HEAD_INIT immortal while preserving the
119
119
// C-API expectation that the refcnt will be set to 1.
120
- #if defined(Py_NOGIL )
120
+ #if defined(Py_GIL_DISABLED )
121
121
#define PyObject_HEAD_INIT (type ) \
122
122
{ \
123
123
0, \
@@ -162,7 +162,7 @@ check by comparing the reference count field to the immortality reference count.
162
162
* by hand. Similarly every pointer to a variable-size Python object can,
163
163
* in addition, be cast to PyVarObject*.
164
164
*/
165
- #ifndef Py_NOGIL
165
+ #ifndef Py_GIL_DISABLED
166
166
struct _object {
167
167
#if (defined(__GNUC__ ) || defined(__clang__ )) \
168
168
&& !(defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L )
@@ -238,7 +238,7 @@ typedef struct {
238
238
PyAPI_FUNC (int ) Py_Is (PyObject * x , PyObject * y );
239
239
#define Py_Is (x , y ) ((x) == (y))
240
240
241
- #if defined(Py_NOGIL ) && !defined(Py_LIMITED_API )
241
+ #if defined(Py_GIL_DISABLED ) && !defined(Py_LIMITED_API )
242
242
static inline uintptr_t
243
243
_Py_ThreadId (void )
244
244
{
@@ -275,7 +275,7 @@ _Py_IsOwnedByCurrentThread(PyObject *ob)
275
275
#endif
276
276
277
277
static inline Py_ssize_t Py_REFCNT (PyObject * ob ) {
278
- #if !defined(Py_NOGIL )
278
+ #if !defined(Py_GIL_DISABLED )
279
279
return ob -> ob_refcnt ;
280
280
#else
281
281
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) {
316
316
317
317
static inline Py_ALWAYS_INLINE int _Py_IsImmortal (PyObject * op )
318
318
{
319
- #if defined(Py_NOGIL )
319
+ #if defined(Py_GIL_DISABLED )
320
320
return op -> ob_ref_local == _Py_IMMORTAL_REFCNT_LOCAL ;
321
321
#elif SIZEOF_VOID_P > 4
322
322
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) {
350
350
if (_Py_IsImmortal (ob )) {
351
351
return ;
352
352
}
353
- #ifndef Py_NOGIL
353
+ #ifndef Py_GIL_DISABLED
354
354
ob -> ob_refcnt = refcnt ;
355
355
#else
356
356
if (_Py_IsOwnedByCurrentThread (ob )) {
@@ -367,7 +367,7 @@ static inline void Py_SET_REFCNT(PyObject *ob, Py_ssize_t refcnt) {
367
367
ob -> ob_ref_local = 0 ;
368
368
ob -> ob_ref_shared = _Py_REF_SHARED (refcnt , _Py_REF_MERGED );
369
369
}
370
- #endif // Py_NOGIL
370
+ #endif // Py_GIL_DISABLED
371
371
#endif // Py_LIMITED_API+0 < 0x030d0000
372
372
}
373
373
#if !defined(Py_LIMITED_API ) || Py_LIMITED_API + 0 < 0x030b0000
@@ -746,7 +746,7 @@ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
746
746
#else
747
747
// Non-limited C API and limited C API for Python 3.9 and older access
748
748
// directly PyObject.ob_refcnt.
749
- #if defined(Py_NOGIL )
749
+ #if defined(Py_GIL_DISABLED )
750
750
uint32_t local = _Py_atomic_load_uint32_relaxed (& op -> ob_ref_local );
751
751
uint32_t new_local = local + 1 ;
752
752
if (new_local == 0 ) {
@@ -784,7 +784,7 @@ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
784
784
#endif
785
785
786
786
787
- #if !defined(Py_LIMITED_API ) && defined(Py_NOGIL )
787
+ #if !defined(Py_LIMITED_API ) && defined(Py_GIL_DISABLED )
788
788
// Implements Py_DECREF on objects not owned by the current thread.
789
789
PyAPI_FUNC (void ) _Py_DecRefShared (PyObject * );
790
790
PyAPI_FUNC (void ) _Py_DecRefSharedDebug (PyObject * , const char * , int );
@@ -810,7 +810,7 @@ static inline void Py_DECREF(PyObject *op) {
810
810
}
811
811
#define Py_DECREF (op ) Py_DECREF(_PyObject_CAST(op))
812
812
813
- #elif defined(Py_NOGIL ) && defined(Py_REF_DEBUG )
813
+ #elif defined(Py_GIL_DISABLED ) && defined(Py_REF_DEBUG )
814
814
static inline void Py_DECREF (const char * filename , int lineno , PyObject * op )
815
815
{
816
816
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)
835
835
}
836
836
#define Py_DECREF (op ) Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op))
837
837
838
- #elif defined(Py_NOGIL )
838
+ #elif defined(Py_GIL_DISABLED )
839
839
static inline void Py_DECREF (PyObject * op )
840
840
{
841
841
uint32_t local = _Py_atomic_load_uint32_relaxed (& op -> ob_ref_local );
0 commit comments