summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Include/cpython/pystate.h2
-rw-r--r--Include/internal/pycore_tstate.h2
-rw-r--r--Modules/_asynciomodule.c8
-rw-r--r--Python/pystate.c4
4 files changed, 8 insertions, 8 deletions
diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h
index ce05042..bb2af78 100644
--- a/Include/cpython/pystate.h
+++ b/Include/cpython/pystate.h
@@ -68,8 +68,6 @@ struct _ts {
pycore_ceval.h. */
uintptr_t eval_breaker;
- PyObject *asyncio_running_loop; // Strong reference
-
struct {
/* Has been initialized to a safe state.
diff --git a/Include/internal/pycore_tstate.h b/Include/internal/pycore_tstate.h
index befca95..1ed5b1d 100644
--- a/Include/internal/pycore_tstate.h
+++ b/Include/internal/pycore_tstate.h
@@ -21,6 +21,8 @@ typedef struct _PyThreadStateImpl {
// semi-public fields are in PyThreadState.
PyThreadState base;
+ PyObject *asyncio_running_loop; // Strong reference
+
struct _qsbr_thread_state *qsbr; // only used by free-threaded build
struct llist_node mem_free_queue; // delayed free queue
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index 31a45f8..05ac09f 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -324,7 +324,7 @@ get_event_loop(asyncio_state *state)
PyObject *loop;
PyObject *policy;
- PyThreadState *ts = _PyThreadState_GET();
+ _PyThreadStateImpl *ts = (_PyThreadStateImpl *)_PyThreadState_GET();
loop = Py_XNewRef(ts->asyncio_running_loop);
if (loop != NULL) {
@@ -3278,7 +3278,7 @@ static PyObject *
_asyncio__get_running_loop_impl(PyObject *module)
/*[clinic end generated code: output=b4390af721411a0a input=0a21627e25a4bd43]*/
{
- PyThreadState *ts = _PyThreadState_GET();
+ _PyThreadStateImpl *ts = (_PyThreadStateImpl *)_PyThreadState_GET();
PyObject *loop = Py_XNewRef(ts->asyncio_running_loop);
if (loop == NULL) {
/* There's no currently running event loop */
@@ -3302,7 +3302,7 @@ static PyObject *
_asyncio__set_running_loop(PyObject *module, PyObject *loop)
/*[clinic end generated code: output=ae56bf7a28ca189a input=4c9720233d606604]*/
{
- PyThreadState *ts = _PyThreadState_GET();
+ _PyThreadStateImpl *ts = (_PyThreadStateImpl *)_PyThreadState_GET();
if (loop == Py_None) {
loop = NULL;
}
@@ -3344,7 +3344,7 @@ _asyncio_get_running_loop_impl(PyObject *module)
/*[clinic end generated code: output=c247b5f9e529530e input=2a3bf02ba39f173d]*/
{
PyObject *loop;
- PyThreadState *ts = _PyThreadState_GET();
+ _PyThreadStateImpl *ts = (_PyThreadStateImpl *)_PyThreadState_GET();
loop = Py_XNewRef(ts->asyncio_running_loop);
if (loop == NULL) {
/* There's no currently running event loop */
diff --git a/Python/pystate.c b/Python/pystate.c
index f77a2cc..7a272de 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -1499,7 +1499,7 @@ init_threadstate(_PyThreadStateImpl *_tstate,
tstate->previous_executor = NULL;
tstate->dict_global_version = 0;
- tstate->asyncio_running_loop = NULL;
+ _tstate->asyncio_running_loop = NULL;
tstate->delete_later = NULL;
@@ -1702,7 +1702,7 @@ PyThreadState_Clear(PyThreadState *tstate)
/* Don't clear tstate->pyframe: it is a borrowed reference */
- Py_CLEAR(tstate->asyncio_running_loop);
+ Py_CLEAR(((_PyThreadStateImpl *)tstate)->asyncio_running_loop);
Py_CLEAR(tstate->dict);
Py_CLEAR(tstate->async_exc);