diff options
author | Jason Fried <me@jasonfried.info> | 2024-09-26 05:26:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-26 05:26:23 (GMT) |
commit | 46f5cbca4c37c57f718d3de0d7f7ddfc44298535 (patch) | |
tree | 74b5e14dddeeccbcd7dfb142aa0a647d2c68e0f8 /Python/context.c | |
parent | de929f353c413459834a2a37b2d9b0240673d874 (diff) | |
download | cpython-46f5cbca4c37c57f718d3de0d7f7ddfc44298535.zip cpython-46f5cbca4c37c57f718d3de0d7f7ddfc44298535.tar.gz cpython-46f5cbca4c37c57f718d3de0d7f7ddfc44298535.tar.bz2 |
gh-119333: get interp from tstate for PyContext watchers(#124444)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Diffstat (limited to 'Python/context.c')
-rw-r--r-- | Python/context.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/context.c b/Python/context.c index e52efbb..ddb0355 100644 --- a/Python/context.c +++ b/Python/context.c @@ -112,10 +112,10 @@ context_event_name(PyContextEvent event) { Py_UNREACHABLE(); } -static void notify_context_watchers(PyContextEvent event, PyContext *ctx) +static void notify_context_watchers(PyContextEvent event, PyContext *ctx, PyThreadState *ts) { assert(Py_REFCNT(ctx) > 0); - PyInterpreterState *interp = _PyInterpreterState_GET(); + PyInterpreterState *interp = ts->interp; assert(interp->_initialized); uint8_t bits = interp->active_context_watchers; int i = 0; @@ -192,7 +192,7 @@ _PyContext_Enter(PyThreadState *ts, PyObject *octx) ts->context = Py_NewRef(ctx); ts->context_ver++; - notify_context_watchers(Py_CONTEXT_EVENT_ENTER, ctx); + notify_context_watchers(Py_CONTEXT_EVENT_ENTER, ctx, ts); return 0; } @@ -226,7 +226,7 @@ _PyContext_Exit(PyThreadState *ts, PyObject *octx) return -1; } - notify_context_watchers(Py_CONTEXT_EVENT_EXIT, ctx); + notify_context_watchers(Py_CONTEXT_EVENT_EXIT, ctx, ts); Py_SETREF(ts->context, (PyObject *)ctx->ctx_prev); ts->context_ver++; |