gh-111863: Rename Py_NOGIL to Py_GIL_DISABLED (#111864)

Rename Py_NOGIL to Py_GIL_DISABLED
This commit is contained in:
Hugo van Kemenade 2023-11-20 15:52:00 +02:00 • committed by GitHub
parent 1c8f912ebd
commit 3b3ec0d77f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 82 additions and 81 deletions

View file

@ -1,8 +1,8 @@
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#include "pyconfig.h" // Py_GIL_DISABLED
#endif
#ifndef Py_NOGIL
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030c0000
#endif

View file

@ -2,9 +2,9 @@
posixshmem - A Python extension that provides shm_open() and shm_unlink()
*/
#include "pyconfig.h" // Py_NOGIL
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_NOGIL
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030c0000
#endif

View file

@ -4,10 +4,10 @@
*/
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#include "pyconfig.h" // Py_GIL_DISABLED
#endif
#ifndef Py_NOGIL
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030c0000
#endif

View file

@ -12,10 +12,10 @@
*/
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#include "pyconfig.h" // Py_GIL_DISABLED
#endif
#ifndef Py_NOGIL
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.13 for PyModule_Add() on Windows
#define Py_LIMITED_API 0x030d0000
#endif

View file

@ -57,12 +57,12 @@ _sysconfig_config_vars_impl(PyObject *module)
}
#endif
#ifdef Py_NOGIL
#ifdef Py_GIL_DISABLED
PyObject *py_nogil = _PyLong_GetOne();
#else
PyObject *py_nogil = _PyLong_GetZero();
#endif
if (PyDict_SetItemString(config, "Py_NOGIL", py_nogil) < 0) {
if (PyDict_SetItemString(config, "Py_GIL_DISABLED", py_nogil) < 0) {
Py_DECREF(config);
return NULL;
}

View file

@ -1,8 +1,8 @@
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#include "pyconfig.h" // Py_GIL_DISABLED
#endif
#ifndef Py_NOGIL
#ifndef Py_GIL_DISABLED
#define Py_LIMITED_API 0x030c0000 // 3.12
#endif

View file

@ -1,10 +1,10 @@
/* Test Vectorcall in the limited API */
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#include "pyconfig.h" // Py_GIL_DISABLED
#endif
#ifndef Py_NOGIL
#ifndef Py_GIL_DISABLED
#define Py_LIMITED_API 0x030c0000 // 3.12
#endif

View file

@ -5,10 +5,10 @@
#undef Py_BUILD_CORE_BUILTIN
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#include "pyconfig.h" // Py_GIL_DISABLED
#endif
#ifndef Py_NOGIL
#ifndef Py_GIL_DISABLED
// For now, only limited C API 3.13 is supported
#define Py_LIMITED_API 0x030d0000
#endif

View file

@ -5,10 +5,10 @@
*/
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#include "pyconfig.h" // Py_GIL_DISABLED
#endif
#ifndef Py_NOGIL
#ifndef Py_GIL_DISABLED
#define Py_LIMITED_API 0x03020000
#endif

View file

@ -6,7 +6,7 @@
#include "pycore_critical_section.h"
#ifdef Py_NOGIL
#ifdef Py_GIL_DISABLED
#define assert_nogil assert
#define assert_gil(x)
#else
@ -25,7 +25,7 @@ test_critical_sections(PyObject *self, PyObject *Py_UNUSED(args))
assert(d2 != NULL);
// Beginning a critical section should lock the associated object and
// push the critical section onto the thread's stack (in Py_NOGIL builds).
// push the critical section onto the thread's stack (in Py_GIL_DISABLED builds).
Py_BEGIN_CRITICAL_SECTION(d1);
assert_nogil(PyMutex_IsLocked(&d1->ob_mutex));
assert_nogil(_PyCriticalSection_IsActive(PyThreadState_GET()->critical_section));

View file

@ -4,10 +4,10 @@
*/
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#include "pyconfig.h" // Py_GIL_DISABLED
#endif
#ifndef Py_NOGIL
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030c0000
#endif

View file

@ -1,10 +1,10 @@
/* Errno module */
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#include "pyconfig.h" // Py_GIL_DISABLED
#endif
#ifndef Py_NOGIL
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030c0000
#endif

View file

@ -58,7 +58,7 @@
PyMutex_Unlock(&(obj)->mutex); \
}
#ifdef Py_NOGIL
#ifdef Py_GIL_DISABLED
#define HASHLIB_INIT_MUTEX(obj) \
do { \
(obj)->mutex = (PyMutex){0}; \

View file

@ -1,8 +1,8 @@
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#include "pyconfig.h" // Py_GIL_DISABLED
#endif
#ifndef Py_NOGIL
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.13 for PySys_Audit()
#define Py_LIMITED_API 0x030d0000
#endif

View file

@ -63,10 +63,10 @@
*/
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#include "pyconfig.h" // Py_GIL_DISABLED
#endif
#ifndef Py_NOGIL
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030c0000
#endif

View file

@ -6,10 +6,10 @@
*/
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#include "pyconfig.h" // Py_GIL_DISABLED
#endif
#ifndef Py_NOGIL
#ifndef Py_GIL_DISABLED
#define Py_LIMITED_API 0x03050000
#endif