summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-07-27 19:15:47 (GMT)
committerGitHub <noreply@github.com>2023-07-27 19:15:47 (GMT)
commit57ef065eb3a9200aece38dfb6b90055500f076d3 (patch)
tree0f7533f86d5a3750f70deebf66609b13b0d9634f /Include
parent0063ad8189cd4ac84775eb9150b7f3373842568a (diff)
downloadcpython-57ef065eb3a9200aece38dfb6b90055500f076d3.zip
cpython-57ef065eb3a9200aece38dfb6b90055500f076d3.tar.gz
cpython-57ef065eb3a9200aece38dfb6b90055500f076d3.tar.bz2
[3.12] gh-101524: Only Use Public C-API in the _xxsubinterpreters Module (gh-105258) (gh-107303)
The _xxsubinterpreters module was meant to only use public API. Some internal C-API usage snuck in over the last few years (e.g. gh-28969). This fixes that. (cherry picked from commit e6373c0d8b59512aa7f0dea7f3fb162b6ed10fa4) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/interpreteridobject.h (renamed from Include/internal/pycore_interpreteridobject.h)17
-rw-r--r--Include/internal/pycore_pymem.h2
-rw-r--r--Include/interpreteridobject.h17
3 files changed, 21 insertions, 15 deletions
diff --git a/Include/internal/pycore_interpreteridobject.h b/Include/cpython/interpreteridobject.h
index 804831e..5076584 100644
--- a/Include/internal/pycore_interpreteridobject.h
+++ b/Include/cpython/interpreteridobject.h
@@ -1,22 +1,11 @@
-/* Interpreter ID Object */
-
-#ifndef Py_INTERNAL_INTERPRETERIDOBJECT_H
-#define Py_INTERNAL_INTERPRETERIDOBJECT_H
-#ifdef __cplusplus
-extern "C" {
+#ifndef Py_CPYTHON_INTERPRETERIDOBJECT_H
+# error "this header file must not be included directly"
#endif
-#ifndef Py_BUILD_CORE
-# error "this header requires Py_BUILD_CORE define"
-#endif
+/* Interpreter ID Object */
PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type;
PyAPI_FUNC(PyObject *) _PyInterpreterID_New(int64_t);
PyAPI_FUNC(PyObject *) _PyInterpreterState_GetIDObject(PyInterpreterState *);
PyAPI_FUNC(PyInterpreterState *) _PyInterpreterID_LookUp(PyObject *);
-
-#ifdef __cplusplus
-}
-#endif
-#endif // !Py_INTERNAL_INTERPRETERIDOBJECT_H
diff --git a/Include/internal/pycore_pymem.h b/Include/internal/pycore_pymem.h
index c2f0325..81a707a 100644
--- a/Include/internal/pycore_pymem.h
+++ b/Include/internal/pycore_pymem.h
@@ -95,4 +95,4 @@ PyAPI_FUNC(int) _PyMem_SetupAllocators(PyMemAllocatorName allocator);
#ifdef __cplusplus
}
#endif
-#endif // !Py_INTERNAL_PYMEM_H
+#endif /* !Py_INTERNAL_PYMEM_H */
diff --git a/Include/interpreteridobject.h b/Include/interpreteridobject.h
new file mode 100644
index 0000000..8432632
--- /dev/null
+++ b/Include/interpreteridobject.h
@@ -0,0 +1,17 @@
+#ifndef Py_INTERPRETERIDOBJECT_H
+#define Py_INTERPRETERIDOBJECT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_LIMITED_API
+# define Py_CPYTHON_INTERPRETERIDOBJECT_H
+# include "cpython/interpreteridobject.h"
+# undef Py_CPYTHON_INTERPRETERIDOBJECT_H
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERPRETERIDOBJECT_H */