Skip to content

Commit e717b47

Browse files
authored
gh-98608: Move PyInterpreterConfig to pylifecycle.h (#107191)
Move PyInterpreterConfig structure and associated macros from initconfig.h to pylifecycle.h: it's not related to the Python Initialization Configuration.
1 parent db17529 commit e717b47

File tree

2 files changed

+39
-39
lines changed

2 files changed

+39
-39
lines changed

Include/cpython/initconfig.h

-39
Original file line numberDiff line numberDiff line change
@@ -242,45 +242,6 @@ PyAPI_FUNC(PyStatus) PyConfig_SetWideStringList(PyConfig *config,
242242
Py_ssize_t length, wchar_t **items);
243243

244244

245-
/* --- PyInterpreterConfig ------------------------------------ */
246-
247-
#define PyInterpreterConfig_DEFAULT_GIL (0)
248-
#define PyInterpreterConfig_SHARED_GIL (1)
249-
#define PyInterpreterConfig_OWN_GIL (2)
250-
251-
typedef struct {
252-
// XXX "allow_object_sharing"? "own_objects"?
253-
int use_main_obmalloc;
254-
int allow_fork;
255-
int allow_exec;
256-
int allow_threads;
257-
int allow_daemon_threads;
258-
int check_multi_interp_extensions;
259-
int gil;
260-
} PyInterpreterConfig;
261-
262-
#define _PyInterpreterConfig_INIT \
263-
{ \
264-
.use_main_obmalloc = 0, \
265-
.allow_fork = 0, \
266-
.allow_exec = 0, \
267-
.allow_threads = 1, \
268-
.allow_daemon_threads = 0, \
269-
.check_multi_interp_extensions = 1, \
270-
.gil = PyInterpreterConfig_OWN_GIL, \
271-
}
272-
273-
#define _PyInterpreterConfig_LEGACY_INIT \
274-
{ \
275-
.use_main_obmalloc = 1, \
276-
.allow_fork = 1, \
277-
.allow_exec = 1, \
278-
.allow_threads = 1, \
279-
.allow_daemon_threads = 1, \
280-
.check_multi_interp_extensions = 0, \
281-
.gil = PyInterpreterConfig_SHARED_GIL, \
282-
}
283-
284245
/* --- Helper functions --------------------------------------- */
285246

286247
/* Get the original command line arguments, before Python modified them.

Include/cpython/pylifecycle.h

+39
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,45 @@ PyAPI_FUNC(void) _Py_NO_RETURN Py_ExitStatusException(PyStatus err);
3535

3636
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
3737

38+
/* --- PyInterpreterConfig ------------------------------------ */
39+
40+
#define PyInterpreterConfig_DEFAULT_GIL (0)
41+
#define PyInterpreterConfig_SHARED_GIL (1)
42+
#define PyInterpreterConfig_OWN_GIL (2)
43+
44+
typedef struct {
45+
// XXX "allow_object_sharing"? "own_objects"?
46+
int use_main_obmalloc;
47+
int allow_fork;
48+
int allow_exec;
49+
int allow_threads;
50+
int allow_daemon_threads;
51+
int check_multi_interp_extensions;
52+
int gil;
53+
} PyInterpreterConfig;
54+
55+
#define _PyInterpreterConfig_INIT \
56+
{ \
57+
.use_main_obmalloc = 0, \
58+
.allow_fork = 0, \
59+
.allow_exec = 0, \
60+
.allow_threads = 1, \
61+
.allow_daemon_threads = 0, \
62+
.check_multi_interp_extensions = 1, \
63+
.gil = PyInterpreterConfig_OWN_GIL, \
64+
}
65+
66+
#define _PyInterpreterConfig_LEGACY_INIT \
67+
{ \
68+
.use_main_obmalloc = 1, \
69+
.allow_fork = 1, \
70+
.allow_exec = 1, \
71+
.allow_threads = 1, \
72+
.allow_daemon_threads = 1, \
73+
.check_multi_interp_extensions = 0, \
74+
.gil = PyInterpreterConfig_SHARED_GIL, \
75+
}
76+
3877
PyAPI_FUNC(PyStatus) Py_NewInterpreterFromConfig(
3978
PyThreadState **tstate_p,
4079
const PyInterpreterConfig *config);

0 commit comments

Comments
 (0)