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 {
33
33
} PyContextEvent ;
34
34
35
35
/*
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.
38
37
*
39
- * The callback is invoked with the event and a reference to =
38
+ * The callback is invoked with the event and a reference to
40
39
* the context after its entered and before its exited.
41
40
*
42
41
* 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) {
112
112
Py_UNREACHABLE ();
113
113
}
114
114
115
- static void notify_context_watchers (PyContextEvent event , PyContext * ctx )
115
+ static void notify_context_watchers (PyContextEvent event , PyContext * ctx , PyThreadState * ts )
116
116
{
117
117
assert (Py_REFCNT (ctx ) > 0 );
118
- PyInterpreterState * interp = _PyInterpreterState_GET () ;
118
+ PyInterpreterState * interp = ts -> interp ;
119
119
assert (interp -> _initialized );
120
120
uint8_t bits = interp -> active_context_watchers ;
121
121
int i = 0 ;
@@ -192,7 +192,7 @@ _PyContext_Enter(PyThreadState *ts, PyObject *octx)
192
192
ts -> context = Py_NewRef (ctx );
193
193
ts -> context_ver ++ ;
194
194
195
- notify_context_watchers (Py_CONTEXT_EVENT_ENTER , ctx );
195
+ notify_context_watchers (Py_CONTEXT_EVENT_ENTER , ctx , ts );
196
196
return 0 ;
197
197
}
198
198
@@ -226,7 +226,7 @@ _PyContext_Exit(PyThreadState *ts, PyObject *octx)
226
226
return -1 ;
227
227
}
228
228
229
- notify_context_watchers (Py_CONTEXT_EVENT_EXIT , ctx );
229
+ notify_context_watchers (Py_CONTEXT_EVENT_EXIT , ctx , ts );
230
230
Py_SETREF (ts -> context , (PyObject * )ctx -> ctx_prev );
231
231
ts -> context_ver ++ ;
232
232
You can’t perform that action at this time.
0 commit comments