8000 gh-91052: Add C API for watching dictionaries by carljm · Pull Request #31787 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-91 8000 052: Add C API for watching dictionaries #31787

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

Merged
merged 9 commits into from
Oct 7, 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
Over-engineer the watcher bits check
  • Loading branch information
carljm committed Oct 4, 2022
commit 6e5cee2a9ef5c6785498dc3dc3f6885d3fd8731f
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