Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-100000: Cleanup and polish various watchers code #99998

Merged
merged 7 commits into from
Dec 14, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Replace invariant test with assert in function watchers dispatch
  • Loading branch information
itamaro committed Dec 5, 2022
commit 40044c09b4cd796df47a1eddff10b59d319dc7f0
4 changes: 3 additions & 1 deletion Objects/funcobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ notify_func_watchers(PyInterpreterState *interp, PyFunction_WatchEvent event,
assert(i < FUNC_MAX_WATCHERS);
if (bits & 1) {
PyFunction_WatchCallback cb = interp->func_watchers[i];
if ((cb != NULL) && (cb(event, func, new_value) < 0)) {
// callback must be non-null if the watcher bit is set
assert(cb != NULL);
if (cb(event, func, new_value) < 0) {
PyErr_WriteUnraisable((PyObject *) func);
}
}
Expand Down