diff options
author | Mark Shannon <mark@hotpy.org> | 2024-02-02 12:14:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-02 12:14:34 (GMT) |
commit | 0e71a295e9530c939a5efcb45db23cf31e0303b4 (patch) | |
tree | ba3a22d5bece296073aa250a04bc3f4192607281 /Objects/dictobject.c | |
parent | 2091fb2a85c1aa2d9b22c02736b07831bd875c2a (diff) | |
download | cpython-0e71a295e9530c939a5efcb45db23cf31e0303b4.zip cpython-0e71a295e9530c939a5efcb45db23cf31e0303b4.tar.gz cpython-0e71a295e9530c939a5efcb45db23cf31e0303b4.tar.bz2 |
GH-113710: Add a "globals to constants" pass (GH-114592)
Converts specializations of `LOAD_GLOBAL` into constants during tier 2 optimization.
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index e24887b..4bb818b 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -5943,7 +5943,8 @@ PyDict_AddWatcher(PyDict_WatchCallback callback) { PyInterpreterState *interp = _PyInterpreterState_GET(); - for (int i = 0; i < DICT_MAX_WATCHERS; i++) { + /* Start at 2, as 0 and 1 are reserved for CPython */ + for (int i = 2; i < DICT_MAX_WATCHERS; i++) { if (!interp->dict_state.watchers[i]) { interp->dict_state.watchers[i] = callback; return i; |