summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-06-04 01:15:09 (GMT)
committerGitHub <noreply@github.com>2019-06-04 01:15:09 (GMT)
commit0fd2c300c2a85b3b227a907b2a39ef79fa86d850 (patch)
treeffe391ade17e6d581878f22016b065f7306f3fca /Include
parent9535aff9421f0a5639f6e4c4bb0f07a743ea8dba (diff)
downloadcpython-0fd2c300c2a85b3b227a907b2a39ef79fa86d850.zip
cpython-0fd2c300c2a85b3b227a907b2a39ef79fa86d850.tar.gz
cpython-0fd2c300c2a85b3b227a907b2a39ef79fa86d850.tar.bz2
Revert "bpo-36818: Add PyInterpreterState.runtime field. (gh-13129)" (GH-13795)
This reverts commit 396e0a8d9dc65453cb9d53500d0a620602656cfe.
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, 20 insertions, 15 deletions
diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h
index 74e7fc9..94b0809 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
- * _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).
+ * _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).
* 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 1c5beb0..81548f8 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -19,10 +19,9 @@ 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: _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.
+ * 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.
*
* 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 e303417..8a692ea 100644
--- a/Include/internal/pycore_pylifecycle.h
+++ b/Include/internal/pycore_pylifecycle.h
@@ -39,10 +39,13 @@ 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(PyInterpreterState *interp);
+extern int _PySys_InitMain(
+ _PyRuntimeState *runtime,
+ PyInterpreterState *interp);
extern PyStatus _PyImport_Init(PyInterpreterState *interp);
extern PyStatus _PyExc_Init(void);
extern PyStatus _PyErr_Init(void);
@@ -83,7 +86,10 @@ extern void _PyHash_Fini(void);
extern int _PyTraceMalloc_Fini(void);
extern void _PyWarnings_Fini(PyInterpreterState *interp);
-extern void _PyGILState_Init(PyThreadState *tstate);
+extern void _PyGILState_Init(
+ _PyRuntimeState *runtime,
+ PyInterpreterState *interp,
+ 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 520a74b..3ab4009 100644
--- a/Include/internal/pycore_pystate.h
+++ b/Include/internal/pycore_pystate.h
@@ -19,9 +19,6 @@ extern "C" {
#include "pycore_pymem.h"
#include "pycore_warnings.h"
-// forward
-struct pyruntimestate;
-
/* ceval state */
@@ -71,7 +68,6 @@ struct _is {
struct _is *next;
struct _ts *tstate_head;
- struct pyruntimestate *runtime;
int64_t id;
int64_t id_refcount;
@@ -300,8 +296,12 @@ PyAPI_FUNC(void) _PyRuntime_Finalize(void);
/* Other */
-PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *tstate);
-PyAPI_FUNC(void) _PyThreadState_DeleteExcept(PyThreadState *tstate);
+PyAPI_FUNC(void) _PyThreadState_Init(
+ _PyRuntimeState *runtime,
+ PyThreadState *tstate);
+PyAPI_FUNC(void) _PyThreadState_DeleteExcept(
+ _PyRuntimeState *runtime,
+ PyThreadState *tstate);
PyAPI_FUNC(PyThreadState *) _PyThreadState_Swap(
struct _gilstate_runtime_state *gilstate,