mirror of
https://github.com/python/cpython.git
synced 2026-04-13 23:31:02 +00:00
gh-145122: Add _GUARD_NOS_ANY_DICT to prevent STORE_SUBSCR_DICT on frozendict (gh-145039)
This commit is contained in:
parent
4c95ad8e49
commit
0f759f1171
10 changed files with 1244 additions and 1079 deletions
|
|
@ -1348,13 +1348,6 @@ dummy_func(void) {
|
|||
sym_set_type(nos, &PyTuple_Type);
|
||||
}
|
||||
|
||||
op(_GUARD_TOS_DICT, (tos -- tos)) {
|
||||
if (sym_matches_type(tos, &PyDict_Type)) {
|
||||
ADD_OP(_NOP, 0, 0);
|
||||
}
|
||||
sym_set_type(tos, &PyDict_Type);
|
||||
}
|
||||
|
||||
op(_GUARD_NOS_DICT, (nos, unused -- nos, unused)) {
|
||||
if (sym_matches_type(nos, &PyDict_Type)) {
|
||||
ADD_OP(_NOP, 0, 0);
|
||||
|
|
@ -1362,6 +1355,22 @@ dummy_func(void) {
|
|||
sym_set_type(nos, &PyDict_Type);
|
||||
}
|
||||
|
||||
op(_GUARD_NOS_ANY_DICT, (nos, unused -- nos, unused)) {
|
||||
PyTypeObject *tp = sym_get_type(nos);
|
||||
if (tp == &PyDict_Type || tp == &PyFrozenDict_Type) {
|
||||
ADD_OP(_NOP, 0, 0);
|
||||
sym_set_type(nos, tp);
|
||||
}
|
||||
}
|
||||
|
||||
op(_GUARD_TOS_ANY_DICT, (tos -- tos)) {
|
||||
PyTypeObject *tp = sym_get_type(tos);
|
||||
if (tp == &PyDict_Type || tp == &PyFrozenDict_Type) {
|
||||
ADD_OP(_NOP, 0, 0);
|
||||
sym_set_type(tos, tp);
|
||||
}
|
||||
}
|
||||
|
||||
op(_GUARD_TOS_ANY_SET, (tos -- tos)) {
|
||||
if (sym_matches_type(tos, &PySet_Type) ||
|
||||
sym_matches_type(tos, &PyFrozenSet_Type))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue