Skip to content

Commit b08940e

Browse files
committed
pass in ts from the Exit and Enter functions
1 parent ac1bb13 commit b08940e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Python/context.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,9 @@ context_event_name(PyContextEvent event) {
112112
Py_UNREACHABLE();
113113
}
114114

115-
static void notify_context_watchers(PyContextEvent event, PyContext *ctx)
115+
static void notify_context_watchers(PyContextEvent event, PyContext *ctx, PyThreadState *ts)
116116
{
117117
assert(Py_REFCNT(ctx) > 0);
118-
PyThreadState *ts = _PyThreadState_GET();
119-
assert(ts != NULL);
120118
PyInterpreterState *interp = ts->interp;
121119
assert(interp->_initialized);
122120
uint8_t bits = interp->active_context_watchers;
@@ -194,7 +192,7 @@ _PyContext_Enter(PyThreadState *ts, PyObject *octx)
194192
ts->context = Py_NewRef(ctx);
195193
ts->context_ver++;
196194

197-
notify_context_watchers(Py_CONTEXT_EVENT_ENTER, ctx);
195+
notify_context_watchers(Py_CONTEXT_EVENT_ENTER, ctx, ts);
198196
return 0;
199197
}
200198

@@ -228,7 +226,7 @@ _PyContext_Exit(PyThreadState *ts, PyObject *octx)
228226
return -1;
229227
}
230228

231-
notify_context_watchers(Py_CONTEXT_EVENT_EXIT, ctx);
229+
notify_context_watchers(Py_CONTEXT_EVENT_EXIT, ctx, ts);
232230
Py_SETREF(ts->context, (PyObject *)ctx->ctx_prev);
233231
ts->context_ver++;
234232

0 commit comments

Comments
 (0)