Skip to content

Commit aa85c93

Browse files
authored
gh-106320: Remove _PyInterpreterState_HasFeature() (#106425)
Remove the _PyInterpreterState_HasFeature() function from the C API: move it to the internal C API (pycore_interp.h). No longer export the function.
1 parent 318ea2c commit aa85c93

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

Include/cpython/pystate.h

-32
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,6 @@
33
#endif
44

55

6-
/*
7-
Runtime Feature Flags
8-
9-
Each flag indicate whether or not a specific runtime feature
10-
is available in a given context. For example, forking the process
11-
might not be allowed in the current interpreter (i.e. os.fork() would fail).
12-
*/
13-
14-
/* Set if the interpreter share obmalloc runtime state
15-
with the main interpreter. */
16-
#define Py_RTFLAGS_USE_MAIN_OBMALLOC (1UL << 5)
17-
18-
/* Set if import should check a module for subinterpreter support. */
19-
#define Py_RTFLAGS_MULTI_INTERP_EXTENSIONS (1UL << 8)
20-
21-
/* Set if threads are allowed. */
22-
#define Py_RTFLAGS_THREADS (1UL << 10)
23-
24-
/* Set if daemon threads are allowed. */
25-
#define Py_RTFLAGS_DAEMON_THREADS (1UL << 11)
26-
27-
/* Set if os.fork() is allowed. */
28-
#define Py_RTFLAGS_FORK (1UL << 15)
29-
30-
/* Set if os.exec*() is allowed. */
31-
#define Py_RTFLAGS_EXEC (1UL << 16)
32-
33-
34-
PyAPI_FUNC(int) _PyInterpreterState_HasFeature(PyInterpreterState *interp,
35-
unsigned long feature);
36-
37-
386
/* private interpreter helpers */
397

408
PyAPI_FUNC(int) _PyInterpreterState_RequiresIDRef(PyInterpreterState *);

Include/internal/pycore_interp.h

+32
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,38 @@ PyAPI_FUNC(int) _PyInterpreterState_GetConfigCopy(
275275
PyAPI_FUNC(int) _PyInterpreterState_SetConfig(
276276
const struct PyConfig *config);
277277

278+
279+
/*
280+
Runtime Feature Flags
281+
282+
Each flag indicate whether or not a specific runtime feature
283+
is available in a given context. For example, forking the process
284+
might not be allowed in the current interpreter (i.e. os.fork() would fail).
285+
*/
286+
287+
/* Set if the interpreter share obmalloc runtime state
288+
with the main interpreter. */
289+
#define Py_RTFLAGS_USE_MAIN_OBMALLOC (1UL << 5)
290+
291+
/* Set if import should check a module for subinterpreter support. */
292+
#define Py_RTFLAGS_MULTI_INTERP_EXTENSIONS (1UL << 8)
293+
294+
/* Set if threads are allowed. */
295+
#define Py_RTFLAGS_THREADS (1UL << 10)
296+
297+
/* Set if daemon threads are allowed. */
298+
#define Py_RTFLAGS_DAEMON_THREADS (1UL << 11)
299+
300+
/* Set if os.fork() is allowed. */
301+
#define Py_RTFLAGS_FORK (1UL << 15)
302+
303+
/* Set if os.exec*() is allowed. */
304+
#define Py_RTFLAGS_EXEC (1UL << 16)
305+
306+
extern int _PyInterpreterState_HasFeature(PyInterpreterState *interp,
307+
unsigned long feature);
308+
309+
278310
#ifdef __cplusplus
279311
}
280312
#endif

0 commit comments

Comments
 (0)