Skip to content

Commit 40044c0

Browse files
committed
Replace invariant test with assert in function watchers dispatch
1 parent 28b1d8d commit 40044c0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Objects/funcobject.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ notify_func_watchers(PyInterpreterState *interp, PyFunction_WatchEvent event,
1818
assert(i < FUNC_MAX_WATCHERS);
1919
if (bits & 1) {
2020
PyFunction_WatchCallback cb = interp->func_watchers[i];
21-
if ((cb != NULL) && (cb(event, func, new_value) < 0)) {
21+
// callback must be non-null if the watcher bit is set
22+
assert(cb != NULL);
23+
if (cb(event, func, new_value) < 0) {
2224
PyErr_WriteUnraisable((PyObject *) func);
2325
}
2426
}

0 commit comments

Comments
 (0)