mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
GH-113710: Add a "globals to constants" pass (GH-114592)
Converts specializations of `LOAD_GLOBAL` into constants during tier 2 optimization.
This commit is contained in:
parent
2091fb2a85
commit
0e71a295e9
16 changed files with 375 additions and 55 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue