diff --git a/Modules/_testinternalcapi/test_cases.c.h b/Modules/_testinternalcapi/test_cases.c.h index 8e7ba1f69553dda..cfa8faa15f4faea 100644 --- a/Modules/_testinternalcapi/test_cases.c.h +++ b/Modules/_testinternalcapi/test_cases.c.h @@ -10120,7 +10120,7 @@ assert(_PyOpcode_Deopt[opcode] == (LOAD_GLOBAL)); JUMP_TO_PREDICTED(LOAD_GLOBAL); } - #if Py_GIL_DISABLED + #ifdef Py_GIL_DISABLED int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res); if (!increfed) { UPDATE_MISS_STATS(LOAD_GLOBAL); @@ -10187,7 +10187,7 @@ assert(_PyOpcode_Deopt[opcode] == (LOAD_GLOBAL)); JUMP_TO_PREDICTED(LOAD_GLOBAL); } - #if Py_GIL_DISABLED + #ifdef Py_GIL_DISABLED int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res); if (!increfed) { UPDATE_MISS_STATS(LOAD_GLOBAL); diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 0fe765c36848f25..5b9e8985d1bea8e 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -14737,7 +14737,7 @@ intern_common(PyInterpreterState *interp, PyObject *s /* stolen */, /* Statically allocated strings must be already interned. */ assert(!_PyUnicode_STATE(s).statically_allocated); -#if Py_GIL_DISABLED +#ifdef Py_GIL_DISABLED /* In the free-threaded build, all interned strings are immortal */ immortalize = 1; #endif diff --git a/PC/pyconfig.h b/PC/pyconfig.h index f969525c1db5c7c..9de3786a0c769b4 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -98,17 +98,15 @@ WIN32 is still required for the locale module. #endif /* Define to 1 when compiling for experimental free-threaded builds */ -#ifdef Py_GIL_DISABLED +#if defined(Py_GIL_DISABLED) && Py_GIL_DISABLED == 0 /* We undefine if it was set to zero because all later checks are #ifdef. * Note that non-Windows builds do not do this, and so every effort should * be made to avoid defining the variable at all when not desired. However, * sysconfig.get_config_var always returns a 1 or a 0, and so it seems likely * that a build backend will define it with the value. */ -#if Py_GIL_DISABLED == 0 #undef Py_GIL_DISABLED #endif -#endif /* Compiler specific defines */ diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 42ad83daa1ea461..bd5debcd01e9bfd 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -2278,7 +2278,7 @@ dummy_func( assert(index < DK_SIZE(keys)); PyObject *res_o = FT_ATOMIC_LOAD_PTR_CONSUME(entries[index].me_value); DEOPT_IF(res_o == NULL); - #if Py_GIL_DISABLED + #ifdef Py_GIL_DISABLED int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res); DEOPT_IF(!increfed); #else @@ -2297,7 +2297,7 @@ dummy_func( PyDictUnicodeEntry *entries = DK_UNICODE_ENTRIES(keys); PyObject *res_o = FT_ATOMIC_LOAD_PTR_CONSUME(entries[index].me_value); DEOPT_IF(res_o == NULL); - #if Py_GIL_DISABLED + #ifdef Py_GIL_DISABLED int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res); DEOPT_IF(!increfed); #else diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index bc85ccd9ddb4fc1..58473deddcebe3c 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -10440,7 +10440,7 @@ SET_CURRENT_CACHED_VALUES(0); JUMP_TO_JUMP_TARGET(); } - #if Py_GIL_DISABLED + #ifdef Py_GIL_DISABLED int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res); if (!increfed) { UOP_STAT_INC(uopcode, miss); @@ -10485,7 +10485,7 @@ SET_CURRENT_CACHED_VALUES(0); JUMP_TO_JUMP_TARGET(); } - #if Py_GIL_DISABLED + #ifdef Py_GIL_DISABLED int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res); if (!increfed) { UOP_STAT_INC(uopcode, miss); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index ee9b64107bb9f24..e5b3548b66412cd 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -10118,7 +10118,7 @@ assert(_PyOpcode_Deopt[opcode] == (LOAD_GLOBAL)); JUMP_TO_PREDICTED(LOAD_GLOBAL); } - #if Py_GIL_DISABLED + #ifdef Py_GIL_DISABLED int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res); if (!increfed) { UPDATE_MISS_STATS(LOAD_GLOBAL); @@ -10185,7 +10185,7 @@ assert(_PyOpcode_Deopt[opcode] == (LOAD_GLOBAL)); JUMP_TO_PREDICTED(LOAD_GLOBAL); } - #if Py_GIL_DISABLED + #ifdef Py_GIL_DISABLED int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res); if (!increfed) { UPDATE_MISS_STATS(LOAD_GLOBAL); diff --git a/Python/lock.c b/Python/lock.c index a2d47eea64a006b..59dfe772a0365f1 100644 --- a/Python/lock.c +++ b/Python/lock.c @@ -25,7 +25,7 @@ static const PyTime_t TIME_TO_BE_FAIR_NS = 1000*1000; // Spin for a bit before parking the thread. This is only enabled for // `--disable-gil` builds because it is unlikely to be helpful if the GIL is // enabled. -#if Py_GIL_DISABLED +#ifdef Py_GIL_DISABLED static const int MAX_SPIN_COUNT = 40; #else static const int MAX_SPIN_COUNT = 0; diff --git a/Python/modsupport.c b/Python/modsupport.c index bab21d1b2be5b51..f944b1c05ba9889 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -767,7 +767,7 @@ int PyABIInfo_Check(PyABIInfo *info, const char *module_name) /* Free-threading/GIL */ uint16_t gilflags = info->flags & (PyABIInfo_GIL | PyABIInfo_FREETHREADED); -#if Py_GIL_DISABLED +#ifdef Py_GIL_DISABLED if (gilflags == PyABIInfo_GIL) { return _abiinfo_raise(module_name, "incompatible with free-threaded CPython");