summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2023-10-30 16:06:09 (GMT)
committerGitHub <noreply@github.com>2023-10-30 16:06:09 (GMT)
commit6dfb8fe0236718e9afc8136ff2b58dcfbc182022 (patch)
tree1b5ad337bc68ebc2ff1325c0b695807c48640d30 /Modules
parent05f2f0ac92afa560315eb66fd6576683c7f69e2d (diff)
downloadcpython-6dfb8fe0236718e9afc8136ff2b58dcfbc182022.zip
cpython-6dfb8fe0236718e9afc8136ff2b58dcfbc182022.tar.gz
cpython-6dfb8fe0236718e9afc8136ff2b58dcfbc182022.tar.bz2
gh-110481: Implement biased reference counting (gh-110764)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes_test.c6
-rw-r--r--Modules/_multiprocessing/posixshmem.c4
-rw-r--r--Modules/_scproxy.c6
-rw-r--r--Modules/_stat.c6
-rw-r--r--Modules/_testcapi/heaptype_relative.c7
-rw-r--r--Modules/_testcapi/vectorcall_limited.c7
-rw-r--r--Modules/_testclinic_limited.c6
-rw-r--r--Modules/_testimportmultiple.c6
-rw-r--r--Modules/_uuidmodule.c6
-rw-r--r--Modules/errnomodule.c6
-rw-r--r--Modules/md5module.c6
-rw-r--r--Modules/resource.c6
-rw-r--r--Modules/xxlimited.c6
-rw-r--r--Modules/xxlimited_35.c6
14 files changed, 84 insertions, 0 deletions
diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c
index df11c00..12d372f 100644
--- a/Modules/_ctypes/_ctypes_test.c
+++ b/Modules/_ctypes/_ctypes_test.c
@@ -1,5 +1,11 @@
+#ifndef _MSC_VER
+#include "pyconfig.h" // Py_NOGIL
+#endif
+
+#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
+#endif
// gh-85283: On Windows, Py_LIMITED_API requires Py_BUILD_CORE to not attempt
// linking the extension to python3.lib (which fails). Py_BUILD_CORE_MODULE is
diff --git a/Modules/_multiprocessing/posixshmem.c b/Modules/_multiprocessing/posixshmem.c
index c4d1138..dc3c59d 100644
--- a/Modules/_multiprocessing/posixshmem.c
+++ b/Modules/_multiprocessing/posixshmem.c
@@ -2,8 +2,12 @@
posixshmem - A Python extension that provides shm_open() and shm_unlink()
*/
+#include "pyconfig.h" // Py_NOGIL
+
+#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
+#endif
#include <Python.h>
diff --git a/Modules/_scproxy.c b/Modules/_scproxy.c
index 2f1b861..c8e120e 100644
--- a/Modules/_scproxy.c
+++ b/Modules/_scproxy.c
@@ -3,8 +3,14 @@
* using the SystemConfiguration framework.
*/
+#ifndef _MSC_VER
+#include "pyconfig.h" // Py_NOGIL
+#endif
+
+#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
+#endif
#include <Python.h>
#include <SystemConfiguration/SystemConfiguration.h>
diff --git a/Modules/_stat.c b/Modules/_stat.c
index 402fbba..d003560 100644
--- a/Modules/_stat.c
+++ b/Modules/_stat.c
@@ -11,8 +11,14 @@
*
*/
+#ifndef _MSC_VER
+#include "pyconfig.h" // Py_NOGIL
+#endif
+
// Need limited C API version 3.13 for PyModule_Add() on Windows
+#ifndef Py_NOGIL
#define Py_LIMITED_API 0x030d0000
+#endif
#include "Python.h"
diff --git a/Modules/_testcapi/heaptype_relative.c b/Modules/_testcapi/heaptype_relative.c
index 53dd01d..b58d26c 100644
--- a/Modules/_testcapi/heaptype_relative.c
+++ b/Modules/_testcapi/heaptype_relative.c
@@ -1,4 +1,11 @@
+#ifndef _MSC_VER
+#include "pyconfig.h" // Py_NOGIL
+#endif
+
+#ifndef Py_NOGIL
#define Py_LIMITED_API 0x030c0000 // 3.12
+#endif
+
#include "parts.h"
#include <stddef.h> // max_align_t
#include <string.h> // memset
diff --git a/Modules/_testcapi/vectorcall_limited.c b/Modules/_testcapi/vectorcall_limited.c
index 3e81903..857cb30 100644
--- a/Modules/_testcapi/vectorcall_limited.c
+++ b/Modules/_testcapi/vectorcall_limited.c
@@ -1,6 +1,13 @@
/* Test Vectorcall in the limited API */
+#ifndef _MSC_VER
+#include "pyconfig.h" // Py_NOGIL
+#endif
+
+#ifndef Py_NOGIL
#define Py_LIMITED_API 0x030c0000 // 3.12
+#endif
+
#include "parts.h"
#include "clinic/vectorcall_limited.c.h"
diff --git a/Modules/_testclinic_limited.c b/Modules/_testclinic_limited.c
index 4273383..63ebb52 100644
--- a/Modules/_testclinic_limited.c
+++ b/Modules/_testclinic_limited.c
@@ -4,8 +4,14 @@
#undef Py_BUILD_CORE_MODULE
#undef Py_BUILD_CORE_BUILTIN
+#ifndef _MSC_VER
+#include "pyconfig.h" // Py_NOGIL
+#endif
+
// For now, only limited C API 3.13 is supported
+#ifndef Py_NOGIL
#define Py_LIMITED_API 0x030d0000
+#endif
/* Always enable assertions */
#undef NDEBUG
diff --git a/Modules/_testimportmultiple.c b/Modules/_testimportmultiple.c
index a13024d..99d48b6 100644
--- a/Modules/_testimportmultiple.c
+++ b/Modules/_testimportmultiple.c
@@ -4,7 +4,13 @@
* foo, bar), only the first one is called the same as the compiled file.
*/
+#ifndef _MSC_VER
+#include "pyconfig.h" // Py_NOGIL
+#endif
+
+#ifndef Py_NOGIL
#define Py_LIMITED_API 0x03020000
+#endif
#include <Python.h>
diff --git a/Modules/_uuidmodule.c b/Modules/_uuidmodule.c
index b35cccb..8bda1d6 100644
--- a/Modules/_uuidmodule.c
+++ b/Modules/_uuidmodule.c
@@ -3,8 +3,14 @@
* DCE compatible Universally Unique Identifier library.
*/
+#ifndef _MSC_VER
+#include "pyconfig.h" // Py_NOGIL
+#endif
+
+#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
+#endif
#include "Python.h"
#if defined(HAVE_UUID_H)
diff --git a/Modules/errnomodule.c b/Modules/errnomodule.c
index e4fd3b4..5ac4d29 100644
--- a/Modules/errnomodule.c
+++ b/Modules/errnomodule.c
@@ -1,7 +1,13 @@
/* Errno module */
+#ifndef _MSC_VER
+#include "pyconfig.h" // Py_NOGIL
+#endif
+
+#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
+#endif
#include "Python.h"
#include <errno.h> // EPIPE
diff --git a/Modules/md5module.c b/Modules/md5module.c
index 9d412ba..ff7fc09 100644
--- a/Modules/md5module.c
+++ b/Modules/md5module.c
@@ -16,8 +16,14 @@
/* MD5 objects */
+#ifndef _MSC_VER
+#include "pyconfig.h" // Py_NOGIL
+#endif
+
+#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
+#endif
#include "Python.h"
#include "hashlib.h"
diff --git a/Modules/resource.c b/Modules/resource.c
index c973008..eb9c2e2 100644
--- a/Modules/resource.c
+++ b/Modules/resource.c
@@ -1,5 +1,11 @@
+#ifndef _MSC_VER
+#include "pyconfig.h" // Py_NOGIL
+#endif
+
+#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
+#endif
#include "Python.h"
#include <errno.h> // errno
diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c
index df6e593..3dcf74a 100644
--- a/Modules/xxlimited.c
+++ b/Modules/xxlimited.c
@@ -62,8 +62,14 @@
pass
*/
+#ifndef _MSC_VER
+#include "pyconfig.h" // Py_NOGIL
+#endif
+
+#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
+#endif
#include "Python.h"
#include <string.h>
diff --git a/Modules/xxlimited_35.c b/Modules/xxlimited_35.c
index 361c7e7..04673ea 100644
--- a/Modules/xxlimited_35.c
+++ b/Modules/xxlimited_35.c
@@ -5,7 +5,13 @@
* See the xxlimited module for an extension module template.
*/
+#ifndef _MSC_VER
+#include "pyconfig.h" // Py_NOGIL
+#endif
+
+#ifndef Py_NOGIL
#define Py_LIMITED_API 0x03050000
+#endif
#include "Python.h"