bpo-39947: Add _PyThreadState_GetDict() function (GH-19160) · python/cpython@0e427c6 · GitHub
Skip to content

Commit 0e427c6

Browse files
authored
bpo-39947: Add _PyThreadState_GetDict() function (GH-19160)
1 parent 302e5a8 commit 0e427c6

3 files changed

Lines changed: 23 additions & 11 deletions

File tree

Include/cpython/pystate.h

Lines changed: 2 additions & 0 deletions

Modules/_asynciomodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,13 @@ get_running_loop(PyObject **loop)
236236
rl = cached_running_holder; // borrowed
237237
}
238238
else {
239-
if (ts->dict == NULL) {
239+
PyObject *ts_dict = _PyThreadState_GetDict(ts); // borrowed
240+
if (ts_dict == NULL) {
240241
goto not_found;
241242
}
242243

243244
rl = _PyDict_GetItemIdWithError(
244-
ts->dict, &PyId___asyncio_running_event_loop__); // borrowed
245+
ts_dict, &PyId___asyncio_running_event_loop__); // borrowed
245246
if (rl == NULL) {
246247
if (PyErr_Occurred()) {
247248
goto error;

Python/pystate.c

Lines changed: 18 additions & 9 deletions

0 commit comments

Comments
 (0)