]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-98608: Move PyInterpreterConfig to pylifecycle.h (#107191)
authorVictor Stinner <vstinner@python.org>
Mon, 24 Jul 2023 19:42:04 +0000 (21:42 +0200)
committerGitHub <noreply@github.com>
Mon, 24 Jul 2023 19:42:04 +0000 (19:42 +0000)
Move PyInterpreterConfig structure and associated macros from
initconfig.h to pylifecycle.h: it's not related to the Python
Initialization Configuration.

Include/cpython/initconfig.h
Include/cpython/pylifecycle.h

index c103c2026e40e90a463788dc6ca7358652f06ace..cbae97f12f5377f313dc269e170807ad97ec170a 100644 (file)
@@ -242,45 +242,6 @@ PyAPI_FUNC(PyStatus) PyConfig_SetWideStringList(PyConfig *config,
     Py_ssize_t length, wchar_t **items);
 
 
-/* --- PyInterpreterConfig ------------------------------------ */
-
-#define PyInterpreterConfig_DEFAULT_GIL (0)
-#define PyInterpreterConfig_SHARED_GIL (1)
-#define PyInterpreterConfig_OWN_GIL (2)
-
-typedef struct {
-    // XXX "allow_object_sharing"?  "own_objects"?
-    int use_main_obmalloc;
-    int allow_fork;
-    int allow_exec;
-    int allow_threads;
-    int allow_daemon_threads;
-    int check_multi_interp_extensions;
-    int gil;
-} PyInterpreterConfig;
-
-#define _PyInterpreterConfig_INIT \
-    { \
-        .use_main_obmalloc = 0, \
-        .allow_fork = 0, \
-        .allow_exec = 0, \
-        .allow_threads = 1, \
-        .allow_daemon_threads = 0, \
-        .check_multi_interp_extensions = 1, \
-        .gil = PyInterpreterConfig_OWN_GIL, \
-    }
-
-#define _PyInterpreterConfig_LEGACY_INIT \
-    { \
-        .use_main_obmalloc = 1, \
-        .allow_fork = 1, \
-        .allow_exec = 1, \
-        .allow_threads = 1, \
-        .allow_daemon_threads = 1, \
-        .check_multi_interp_extensions = 0, \
-        .gil = PyInterpreterConfig_SHARED_GIL, \
-    }
-
 /* --- Helper functions --------------------------------------- */
 
 /* Get the original command line arguments, before Python modified them.
index 8af34b056425120146f07f4c959c426b9b2655a0..a78cec9525d5f58e117d7acda0a97459777ecdb4 100644 (file)
@@ -35,6 +35,45 @@ PyAPI_FUNC(void) _Py_NO_RETURN Py_ExitStatusException(PyStatus err);
 
 PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
 
+/* --- PyInterpreterConfig ------------------------------------ */
+
+#define PyInterpreterConfig_DEFAULT_GIL (0)
+#define PyInterpreterConfig_SHARED_GIL (1)
+#define PyInterpreterConfig_OWN_GIL (2)
+
+typedef struct {
+    // XXX "allow_object_sharing"?  "own_objects"?
+    int use_main_obmalloc;
+    int allow_fork;
+    int allow_exec;
+    int allow_threads;
+    int allow_daemon_threads;
+    int check_multi_interp_extensions;
+    int gil;
+} PyInterpreterConfig;
+
+#define _PyInterpreterConfig_INIT \
+    { \
+        .use_main_obmalloc = 0, \
+        .allow_fork = 0, \
+        .allow_exec = 0, \
+        .allow_threads = 1, \
+        .allow_daemon_threads = 0, \
+        .check_multi_interp_extensions = 1, \
+        .gil = PyInterpreterConfig_OWN_GIL, \
+    }
+
+#define _PyInterpreterConfig_LEGACY_INIT \
+    { \
+        .use_main_obmalloc = 1, \
+        .allow_fork = 1, \
+        .allow_exec = 1, \
+        .allow_threads = 1, \
+        .allow_daemon_threads = 1, \
+        .check_multi_interp_extensions = 0, \
+        .gil = PyInterpreterConfig_SHARED_GIL, \
+    }
+
 PyAPI_FUNC(PyStatus) Py_NewInterpreterFromConfig(
     PyThreadState **tstate_p,
     const PyInterpreterConfig *config);