summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2019-06-01 03:16:47 (GMT)
committerGitHub <noreply@github.com>2019-06-01 03:16:47 (GMT)
commit396e0a8d9dc65453cb9d53500d0a620602656cfe (patch)
treee960fe3a38051fd3013bae7fd1b788ca94e9aeca /Include
parent1c263e39c4ed28225a7dc8ca1f24953225ac48ca (diff)
downloadcpython-396e0a8d9dc65453cb9d53500d0a620602656cfe.zip
cpython-396e0a8d9dc65453cb9d53500d0a620602656cfe.tar.gz
cpython-396e0a8d9dc65453cb9d53500d0a620602656cfe.tar.bz2
bpo-36818: Add PyInterpreterState.runtime field. (gh-13129)
https://bugs.python.org/issue36818
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/pystate.h6
-rw-r--r--Include/internal/pycore_object.h7
-rw-r--r--Include/internal/pycore_pylifecycle.h10
-rw-r--r--Include/internal/pycore_pystate.h12
4 files changed, 15 insertions, 20 deletions
diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h
index 94b0809..74e7fc9 100644
--- a/Include/cpython/pystate.h
+++ b/Include/cpython/pystate.h
@@ -110,9 +110,9 @@ struct _ts {
* if the thread holds the last reference to the lock, decref'ing the
* lock will delete the lock, and that may trigger arbitrary Python code
* if there's a weakref, with a callback, to the lock. But by this time
- * _PyRuntime.gilstate.tstate_current is already NULL, so only the simplest
- * of C code can be allowed to run (in particular it must not be possible to
- * release the GIL).
+ * _PyRuntimeState.gilstate.tstate_current is already NULL, so only the
+ * simplest of C code can be allowed to run (in particular it must not be
+ * possible to release the GIL).
* So instead of holding the lock directly, the tstate holds a weakref to
* the lock: that's the value of on_delete_data below. Decref'ing a
* weakref is harmless.
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h
index 81548f8..1c5beb0 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -19,9 +19,10 @@ PyAPI_FUNC(int) _PyDict_CheckConsistency(PyObject *mp, int check_content);
* NB: While the object is tracked by the collector, it must be safe to call the
* ob_traverse method.
*
- * Internal note: _PyRuntime.gc.generation0->_gc_prev doesn't have any bit flags
- * because it's not object header. So we don't use _PyGCHead_PREV() and
- * _PyGCHead_SET_PREV() for it to avoid unnecessary bitwise operations.
+ * Internal note: _PyRuntimeState.gc.generation0->_gc_prev doesn't have
+ * any bit flags because it's not object header. So we don't use
+ * _PyGCHead_PREV() and _PyGCHead_SET_PREV() for it to avoid unnecessary
+ * bitwise operations.
*
* The PyObject_GC_Track() function is the public version of this macro.
*/
diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h
index 8a692ea..e303417 100644
--- a/Include/internal/pycore_pylifecycle.h
+++ b/Include/internal/pycore_pylifecycle.h
@@ -39,13 +39,10 @@ extern PyStatus _PyFaulthandler_Init(int enable);
extern int _PyTraceMalloc_Init(int enable);
extern PyObject * _PyBuiltin_Init(void);
extern PyStatus _PySys_Create(
- _PyRuntimeState *runtime,
PyInterpreterState *interp,
PyObject **sysmod_p);
extern PyStatus _PySys_SetPreliminaryStderr(PyObject *sysdict);
-extern int _PySys_InitMain(
- _PyRuntimeState *runtime,
- PyInterpreterState *interp);
+extern int _PySys_InitMain(PyInterpreterState *interp);
extern PyStatus _PyImport_Init(PyInterpreterState *interp);
extern PyStatus _PyExc_Init(void);
extern PyStatus _PyErr_Init(void);
@@ -86,10 +83,7 @@ extern void _PyHash_Fini(void);
extern int _PyTraceMalloc_Fini(void);
extern void _PyWarnings_Fini(PyInterpreterState *interp);
-extern void _PyGILState_Init(
- _PyRuntimeState *runtime,
- PyInterpreterState *interp,
- PyThreadState *tstate);
+extern void _PyGILState_Init(PyThreadState *tstate);
extern void _PyGILState_Fini(_PyRuntimeState *runtime);
PyAPI_FUNC(void) _PyGC_DumpShutdownStats(_PyRuntimeState *runtime);
diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h
index 3ab4009..520a74b 100644
--- a/Include/internal/pycore_pystate.h
+++ b/Include/internal/pycore_pystate.h
@@ -19,6 +19,9 @@ extern "C" {
#include "pycore_pymem.h"
#include "pycore_warnings.h"
+// forward
+struct pyruntimestate;
+
/* ceval state */
@@ -68,6 +71,7 @@ struct _is {
struct _is *next;
struct _ts *tstate_head;
+ struct pyruntimestate *runtime;
int64_t id;
int64_t id_refcount;
@@ -296,12 +300,8 @@ PyAPI_FUNC(void) _PyRuntime_Finalize(void);
/* Other */
-PyAPI_FUNC(void) _PyThreadState_Init(
- _PyRuntimeState *runtime,
- PyThreadState *tstate);
-PyAPI_FUNC(void) _PyThreadState_DeleteExcept(
- _PyRuntimeState *runtime,
- PyThreadState *tstate);
+PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *tstate);
+PyAPI_FUNC(void) _PyThreadState_DeleteExcept(PyThreadState *tstate);
PyAPI_FUNC(PyThreadState *) _PyThreadState_Swap(
struct _gilstate_runtime_state *gilstate,