Skip to content

Commit 30c698a

Browse files
authored
gh-148398: add type watcher in _CHECK_ATTR_CLASS (GH-148399)
1 parent 3a7df63 commit 30c698a

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a bug in the JIT optimizer where class attribute loads were not invalidated after type mutation.

Python/optimizer_bytecodes.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@ dummy_func(void) {
226226
}
227227
else {
228228
sym_set_const(owner, type);
229+
if ((((PyTypeObject *)type)->tp_flags & Py_TPFLAGS_IMMUTABLETYPE) == 0) {
230+
PyType_Watch(TYPE_WATCHER_ID, type);
231+
_Py_BloomFilter_Add(dependencies, type);
232+
}
229233
}
230234
}
231235
}

Python/optimizer_cases.c.h

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)