]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106320: Remove _PyInterpreterState_HasFeature() (#106425)
authorVictor Stinner <vstinner@python.org>
Tue, 4 Jul 2023 16:55:45 +0000 (18:55 +0200)
committerGitHub <noreply@github.com>
Tue, 4 Jul 2023 16:55:45 +0000 (16:55 +0000)
Remove the _PyInterpreterState_HasFeature() function from the C API:
move it to the internal C API (pycore_interp.h). No longer export
the function.

Include/cpython/pystate.h
Include/internal/pycore_interp.h

index e08bcdaf197628b9a3e1c99f390f97818c06e003..4254110889fc6c657a98feea7797df76f0e9c189 100644 (file)
@@ -3,38 +3,6 @@
 #endif
 
 
-/*
-Runtime Feature Flags
-
-Each flag indicate whether or not a specific runtime feature
-is available in a given context.  For example, forking the process
-might not be allowed in the current interpreter (i.e. os.fork() would fail).
-*/
-
-/* Set if the interpreter share obmalloc runtime state
-   with the main interpreter. */
-#define Py_RTFLAGS_USE_MAIN_OBMALLOC (1UL << 5)
-
-/* Set if import should check a module for subinterpreter support. */
-#define Py_RTFLAGS_MULTI_INTERP_EXTENSIONS (1UL << 8)
-
-/* Set if threads are allowed. */
-#define Py_RTFLAGS_THREADS (1UL << 10)
-
-/* Set if daemon threads are allowed. */
-#define Py_RTFLAGS_DAEMON_THREADS (1UL << 11)
-
-/* Set if os.fork() is allowed. */
-#define Py_RTFLAGS_FORK (1UL << 15)
-
-/* Set if os.exec*() is allowed. */
-#define Py_RTFLAGS_EXEC (1UL << 16)
-
-
-PyAPI_FUNC(int) _PyInterpreterState_HasFeature(PyInterpreterState *interp,
-                                               unsigned long feature);
-
-
 /* private interpreter helpers */
 
 PyAPI_FUNC(int) _PyInterpreterState_RequiresIDRef(PyInterpreterState *);
index a1f00df12d6ac9a793d6beaa7ef45e1dd0c2bf00..bb37cafe6286a9c45c862b1d861aff4bda4156aa 100644 (file)
@@ -275,6 +275,38 @@ PyAPI_FUNC(int) _PyInterpreterState_GetConfigCopy(
 PyAPI_FUNC(int) _PyInterpreterState_SetConfig(
     const struct PyConfig *config);
 
+
+/*
+Runtime Feature Flags
+
+Each flag indicate whether or not a specific runtime feature
+is available in a given context.  For example, forking the process
+might not be allowed in the current interpreter (i.e. os.fork() would fail).
+*/
+
+/* Set if the interpreter share obmalloc runtime state
+   with the main interpreter. */
+#define Py_RTFLAGS_USE_MAIN_OBMALLOC (1UL << 5)
+
+/* Set if import should check a module for subinterpreter support. */
+#define Py_RTFLAGS_MULTI_INTERP_EXTENSIONS (1UL << 8)
+
+/* Set if threads are allowed. */
+#define Py_RTFLAGS_THREADS (1UL << 10)
+
+/* Set if daemon threads are allowed. */
+#define Py_RTFLAGS_DAEMON_THREADS (1UL << 11)
+
+/* Set if os.fork() is allowed. */
+#define Py_RTFLAGS_FORK (1UL << 15)
+
+/* Set if os.exec*() is allowed. */
+#define Py_RTFLAGS_EXEC (1UL << 16)
+
+extern int _PyInterpreterState_HasFeature(PyInterpreterState *interp,
+                                          unsigned long feature);
+
+
 #ifdef __cplusplus
 }
 #endif