File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -33,10 +33,9 @@ typedef enum {
3333} PyContextEvent ;
3434
3535/*
36- * A Callback to clue in non-python contexts impls about a
37- * change in the active python context.
36+ * Callback to be invoked when a context object is entered or exited.
3837 *
39- * The callback is invoked with the event and a reference to =
38+ * The callback is invoked with the event and a reference to
4039 * the context after its entered and before its exited.
4140 *
4241 * if the callback returns with an exception set, it must return -1. Otherwise
Original file line number Diff line number Diff line change @@ -112,10 +112,10 @@ 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- PyInterpreterState * interp = _PyInterpreterState_GET () ;
118+ PyInterpreterState * interp = ts -> interp ;
119119 assert (interp -> _initialized );
120120 uint8_t bits = interp -> active_context_watchers ;
121121 int i = 0 ;
@@ -192,7 +192,7 @@ _PyContext_Enter(PyThreadState *ts, PyObject *octx)
192192 ts -> context = Py_NewRef (ctx );
193193 ts -> context_ver ++ ;
194194
195- notify_context_watchers (Py_CONTEXT_EVENT_ENTER , ctx );
195+ notify_context_watchers (Py_CONTEXT_EVENT_ENTER , ctx , ts );
196196 return 0 ;
197197}
198198
@@ -226,7 +226,7 @@ _PyContext_Exit(PyThreadState *ts, PyObject *octx)
226226 return -1 ;
227227 }
228228
229- notify_context_watchers (Py_CONTEXT_EVENT_EXIT , ctx );
229+ notify_context_watchers (Py_CONTEXT_EVENT_EXIT , ctx , ts );
230230 Py_SETREF (ts -> context , (PyObject * )ctx -> ctx_prev );
231231 ts -> context_ver ++ ;
232232
You can’t perform that action at this time.
0 commit comments