summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Python/ceval_gil.h
diff options
context:
space:
mode:
authorshadchin <[email protected]>2022-04-18 12:39:32 +0300
committershadchin <[email protected]>2022-04-18 12:39:32 +0300
commitd4be68e361f4258cf0848fc70018dfe37a2acc24 (patch)
tree153e294cd97ac8b5d7a989612704a0c1f58e8ad4 /contrib/tools/python3/src/Python/ceval_gil.h
parent260c02f5ccf242d9d9b8a873afaf6588c00237d6 (diff)
IGNIETFERRO-1816 Update Python 3 from 3.9.12 to 3.10.4
ref:9f96be6d02ee8044fdd6f124b799b270c20ce641
Diffstat (limited to 'contrib/tools/python3/src/Python/ceval_gil.h')
-rw-r--r--contrib/tools/python3/src/Python/ceval_gil.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/contrib/tools/python3/src/Python/ceval_gil.h b/contrib/tools/python3/src/Python/ceval_gil.h
index 3510675a69b..9b8b43253f0 100644
--- a/contrib/tools/python3/src/Python/ceval_gil.h
+++ b/contrib/tools/python3/src/Python/ceval_gil.h
@@ -144,7 +144,11 @@ static void
drop_gil(struct _ceval_runtime_state *ceval, struct _ceval_state *ceval2,
PyThreadState *tstate)
{
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+ struct _gil_runtime_state *gil = &ceval2->gil;
+#else
struct _gil_runtime_state *gil = &ceval->gil;
+#endif
if (!_Py_atomic_load_relaxed(&gil->locked)) {
Py_FatalError("drop_gil: GIL is not locked");
}
@@ -228,7 +232,11 @@ take_gil(PyThreadState *tstate)
PyInterpreterState *interp = tstate->interp;
struct _ceval_runtime_state *ceval = &interp->runtime->ceval;
struct _ceval_state *ceval2 = &interp->ceval;
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+ struct _gil_runtime_state *gil = &ceval2->gil;
+#else
struct _gil_runtime_state *gil = &ceval->gil;
+#endif
/* Check that _PyEval_InitThreads() was called to create the lock */
assert(gil_created(gil));
@@ -310,7 +318,7 @@ _ready:
/* Don't access tstate if the thread must exit */
if (tstate->async_exc != NULL) {
- _PyEval_SignalAsyncExc(tstate);
+ _PyEval_SignalAsyncExc(tstate->interp);
}
MUTEX_UNLOCK(gil->mutex);
@@ -320,12 +328,22 @@ _ready:
void _PyEval_SetSwitchInterval(unsigned long microseconds)
{
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+ PyInterpreterState *interp = PyInterpreterState_Get();
+ struct _gil_runtime_state *gil = &interp->ceval.gil;
+#else
struct _gil_runtime_state *gil = &_PyRuntime.ceval.gil;
+#endif
gil->interval = microseconds;
}
unsigned long _PyEval_GetSwitchInterval()
{
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+ PyInterpreterState *interp = PyInterpreterState_Get();
+ struct _gil_runtime_state *gil = &interp->ceval.gil;
+#else
struct _gil_runtime_state *gil = &_PyRuntime.ceval.gil;
+#endif
return gil->interval;
}