Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-124872: Move PyThreadState to first argument for consistency
  • Loading branch information
rhansen committed Oct 1, 2024
commit d3b889f2f23e15c25e054743187f2b9c11e4dfb1
7 changes: 4 additions & 3 deletions Python/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ context_event_name(PyContextEvent event) {
Py_UNREACHABLE();
}

static void notify_context_watchers(PyContextEvent event, PyContext *ctx, PyThreadState *ts)
static void
notify_context_watchers(PyThreadState *ts, PyContextEvent event, PyContext *ctx)
{
assert(Py_REFCNT(ctx) > 0);
PyInterpreterState *interp = ts->interp;
Expand Down Expand Up @@ -192,7 +193,7 @@ _PyContext_Enter(PyThreadState *ts, PyObject *octx)
ts->context = Py_NewRef(ctx);
ts->context_ver++;

notify_context_watchers(Py_CONTEXT_EVENT_ENTER, ctx, ts);
notify_context_watchers(ts, Py_CONTEXT_EVENT_ENTER, ctx);
return 0;
}

Expand Down Expand Up @@ -226,7 +227,7 @@ _PyContext_Exit(PyThreadState *ts, PyObject *octx)
return -1;
}

notify_context_watchers(Py_CONTEXT_EVENT_EXIT, ctx, ts);
notify_context_watchers(ts, Py_CONTEXT_EVENT_EXIT, ctx);
Py_SETREF(ts->context, (PyObject *)ctx->ctx_prev);
ts->context_ver++;

Expand Down