| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1512f78 commit 0a57626
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + Avoid a crash if a context watcher is cleared while other context watchers | ||
| 2 | + are being notified. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -169,8 +169,8 @@ notify_context_watchers(PyThreadState *ts, PyContextEvent event, PyObject *ctx) | |||
| 169 | 169 | assert(i < CONTEXT_MAX_WATCHERS); | |
| 170 | 170 | if (bits & 1) { | |
| 171 | 171 | PyContext_WatchCallback cb = interp->context_watchers[i]; | |
| 172 | - assert(cb != NULL); | ||
| 173 | - if (cb(event, ctx) < 0) { | ||
| 172 | + // A previous callback may have cleared this watcher. | ||
| 173 | + if (cb != NULL && cb(event, ctx) < 0) { | ||
| 174 | 174 | PyErr_FormatUnraisable( | |
| 175 | 175 | "Exception ignored in %s watcher callback for %R", | |
| 176 | 176 | context_event_name(event), ctx); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments