gh-141510: Add _GUARD_NOS_ANY_DICT to prevent STORE_SUBSCR_DICT on frozendict#145039
gh-141510: Add _GUARD_NOS_ANY_DICT to prevent STORE_SUBSCR_DICT on frozendict#145039corona10 wants to merge 2 commits intopython:mainfrom
Conversation
| } | ||
| else if (sym_matches_type(tos, &PyFrozenDict_Type)) { | ||
| ADD_OP(_NOP, 0, 0); | ||
| sym_set_type(tos, &PyFrozenDict_Type); |
There was a problem hiding this comment.
I am not sure this is correct way to handle this.
Should I just follow the same as _GUARD_TOS_ANY_SET which does not call sym_set_type?
|
Without this PR, tthe est code will fail like this: |
Python/bytecodes.c
Outdated
| EXIT_IF(!PyDict_CheckExact(o)); | ||
| } | ||
|
|
||
| op(_GUARD_TOS_DICT, (tos -- tos)) { |
There was a problem hiding this comment.
This guard is no longer needed, it can be removed, no?
There was a problem hiding this comment.
You’re right, I think we can remove the guard. However, let’s wait for Ken and Mark’s opinions on whether deleting it would be safe (I think yes), or if they prefer to leave it as is for potential future use.
There was a problem hiding this comment.
If a uop is no longer needed it's best to remove it so that we don't leave things to bitrot in the code.
There was a problem hiding this comment.
Thanks! I remove the _GUARD_TOS_DICT
|
|
||
| with self.assertRaises(TypeError): | ||
| store_subscr_frozen_dict() | ||
| self.assert_specialized(store_subscr_frozen_dict, "STORE_SUBSCR_DICT") |
There was a problem hiding this comment.
You may also check:
self.assert_no_opcode(store_subscr_frozen_dict, "STORE_SUBSCR")
Uh oh!
There was an error while loading. Please reload this page.