Skip to content

Commit af090d9

Browse files
committed
Rename Py_NOGIL to Py_DISABLE_GIL
1 parent 52ff880 commit af090d9

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

Include/cpython/pystate.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ struct _ts {
151151

152152
/* Tagged pointer to top-most critical section, or zero if there is no
153153
* active critical section. Critical sections are only used in
154-
* `--disable-gil` builds (i.e., when Py_NOGIL is defined to 1). In the
154+
* `--disable-gil` builds (i.e., when Py_DISABLE_GIL is defined to 1). In the
155155
* default build, this field is always zero.
156156
*/
157157
uintptr_t critical_section;

Include/internal/pycore_critical_section.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ extern "C" {
8686
#define _Py_CRITICAL_SECTION_TWO_MUTEXES 0x2
8787
#define _Py_CRITICAL_SECTION_MASK 0x3
8888

89-
#ifdef Py_NOGIL
89+
#ifdef Py_DISABLE_GIL
9090
# define Py_BEGIN_CRITICAL_SECTION(op) \
9191
{ \
9292
_PyCriticalSection _cs; \
@@ -104,13 +104,13 @@ extern "C" {
104104
# define Py_END_CRITICAL_SECTION2() \
105105
_PyCriticalSection2_End(&_cs2); \
106106
}
107-
#else /* !Py_NOGIL */
107+
#else /* !Py_DISABLE_GIL */
108108
// The critical section APIs are no-ops with the GIL.
109109
# define Py_BEGIN_CRITICAL_SECTION(op)
110110
# define Py_END_CRITICAL_SECTION()
111111
# define Py_BEGIN_CRITICAL_SECTION2(a, b)
112112
# define Py_END_CRITICAL_SECTION2()
113-
#endif /* !Py_NOGIL */
113+
#endif /* !Py_DISABLE_GIL */
114114

115115
typedef struct {
116116
// Tagged pointer to an outer active critical section (or 0).

Include/internal/pycore_lock.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ extern "C" {
3333
// ...
3434
// PyMutex_Unlock(&m);
3535

36-
// NOTE: In Py_NOGIL builds, `struct _PyMutex` is defined in Include/object.h.
37-
// The Py_NOGIL builds need the definition in Include/object.h for the
36+
// NOTE: In Py_DISABLE_GIL builds, `struct _PyMutex` is defined in Include/object.h.
37+
// The Py_DISABLE_GIL builds need the definition in Include/object.h for the
3838
// `ob_mutex` field in PyObject. For the default (non-free-threaded) build,
3939
// we define the struct here to avoid exposing it in the public API.
40-
#ifndef Py_NOGIL
40+
#ifndef Py_DISABLE_GIL
4141
struct _PyMutex { uint8_t v; };
4242
#endif
4343

Modules/_testinternalcapi/test_critical_sections.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include "pycore_critical_section.h"
88

9-
#ifdef Py_NOGIL
9+
#ifdef Py_DISABLE_GIL
1010
#define assert_nogil assert
1111
#define assert_gil(x)
1212
#else
@@ -25,7 +25,7 @@ test_critical_sections(PyObject *self, PyObject *Py_UNUSED(args))
2525
assert(d2 != NULL);
2626

2727
// Beginning a critical section should lock the associated object and
28-
// push the critical section onto the thread's stack (in Py_NOGIL builds).
28+
// push the critical section onto the thread's stack (in Py_DISABLE_GIL builds).
2929
Py_BEGIN_CRITICAL_SECTION(d1);
3030
assert_nogil(PyMutex_IsLocked(&d1->ob_mutex));
3131
assert_nogil(_PyCriticalSection_IsActive(PyThreadState_GET()->critical_section));

0 commit comments

Comments
 (0)