mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
bpo-36710: Add PyInterpreterState.runtime field (GH-17270)
Add PyInterpreterState.runtime field: reference to the _PyRuntime global variable. This field exists to not have to pass runtime in addition to tstate to a function. Get runtime from tstate: tstate->interp->runtime. Remove "_PyRuntimeState *runtime" parameter from functions already taking a "PyThreadState *tstate" parameter. _PyGC_Init() first parameter becomes "PyThreadState *tstate".
This commit is contained in:
parent
eb1cbbff1c
commit
01b1cc12e7
8 changed files with 81 additions and 94 deletions
|
@ -38,15 +38,12 @@ extern PyStatus _PyFaulthandler_Init(int enable);
|
|||
extern int _PyTraceMalloc_Init(int enable);
|
||||
extern PyObject * _PyBuiltin_Init(PyThreadState *tstate);
|
||||
extern PyStatus _PySys_Create(
|
||||
struct pyruntimestate *runtime,
|
||||
PyThreadState *tstate,
|
||||
PyObject **sysmod_p);
|
||||
extern PyStatus _PySys_SetPreliminaryStderr(PyObject *sysdict);
|
||||
extern PyStatus _PySys_ReadPreinitWarnOptions(PyWideStringList *options);
|
||||
extern PyStatus _PySys_ReadPreinitXOptions(PyConfig *config);
|
||||
extern int _PySys_InitMain(
|
||||
struct pyruntimestate *runtime,
|
||||
PyThreadState *tstate);
|
||||
extern int _PySys_InitMain(PyThreadState *tstate);
|
||||
extern PyStatus _PyImport_Init(PyThreadState *tstate);
|
||||
extern PyStatus _PyExc_Init(void);
|
||||
extern PyStatus _PyErr_Init(void);
|
||||
|
@ -57,7 +54,7 @@ extern PyStatus _Py_HashRandomization_Init(const PyConfig *);
|
|||
|
||||
extern PyStatus _PyTypes_Init(void);
|
||||
extern PyStatus _PyImportZip_Init(PyThreadState *tstate);
|
||||
extern PyStatus _PyGC_Init(struct pyruntimestate *runtime);
|
||||
extern PyStatus _PyGC_Init(PyThreadState *tstate);
|
||||
|
||||
|
||||
/* Various internal finalizers */
|
||||
|
@ -89,9 +86,7 @@ extern void _PyHash_Fini(void);
|
|||
extern void _PyTraceMalloc_Fini(void);
|
||||
extern void _PyWarnings_Fini(PyInterpreterState *interp);
|
||||
|
||||
extern void _PyGILState_Init(
|
||||
struct pyruntimestate *runtime,
|
||||
PyThreadState *tstate);
|
||||
extern void _PyGILState_Init(PyThreadState *tstate);
|
||||
extern void _PyGILState_Fini(struct pyruntimestate *runtime);
|
||||
|
||||
PyAPI_FUNC(void) _PyGC_DumpShutdownStats(struct pyruntimestate *runtime);
|
||||
|
|
|
@ -62,6 +62,11 @@ struct _is {
|
|||
struct _is *next;
|
||||
struct _ts *tstate_head;
|
||||
|
||||
/* Reference to the _PyRuntime global variable. This field exists
|
||||
to not have to pass runtime in addition to tstate to a function.
|
||||
Get runtime from tstate: tstate->interp->runtime. */
|
||||
struct pyruntimestate *runtime;
|
||||
|
||||
int64_t id;
|
||||
int64_t id_refcount;
|
||||
int requires_idref;
|
||||
|
@ -301,7 +306,6 @@ PyAPI_FUNC(void) _PyRuntime_Finalize(void);
|
|||
/* Other */
|
||||
|
||||
PyAPI_FUNC(void) _PyThreadState_Init(
|
||||
_PyRuntimeState *runtime,
|
||||
PyThreadState *tstate);
|
||||
PyAPI_FUNC(void) _PyThreadState_DeleteExcept(
|
||||
_PyRuntimeState *runtime,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue