Skip to content

Commit

Permalink
Over-engineer the watcher bits check
Browse files Browse the repository at this point in the history
  • Loading branch information
carljm committed Oct 4, 2022
1 parent 1c7f814 commit 6e5cee2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -5765,11 +5765,12 @@ _PyDict_SendEvent(int watcher_bits,
{
PyInterpreterState *interp = _PyInterpreterState_GET();
for (int i = 0; i < DICT_MAX_WATCHERS; i++) {
if (watcher_bits & (1 << i)) {
if (watcher_bits & 1) {
PyDict_WatchCallback cb = (PyDict_WatchCallback)interp->dict_watchers[i];
if (cb) {
cb(event, (PyObject*)mp, key, value);
}
}
watcher_bits >>= 1;
}
}

0 comments on commit 6e5cee2

Please sign in to comment.