Commit 5e01840
committed
Fix SUBSCR_LIST_INT/STORE_SUBSCR_LIST_INT asserting on wide ints
_GUARD_TOS_INT only checks PyLong_CheckExact, so wide (non-compact)
ints can reach _BINARY_OP_SUBSCR_LIST_INT and _STORE_SUBSCR_LIST_INT,
both of which call _PyLong_CompactValue unconditionally. The
specializer correctly gates on _PyLong_IsNonNegativeCompact, but the
runtime guard did not enforce that invariant.
Add EXIT_IF / DEOPT_IF(!_PyLong_IsNonNegativeCompact) before each
_PyLong_CompactValue call so wide-int indices fall back to the slow
path instead of hitting the assertion.
The bug was latent before this branch because BINARY_OP_ADD_INT would
deopt on wide-int operands, so wide results rarely appeared as list
subscripts that had already been specialised for compact ints.1 parent d608803 commit 5e01840
4 files changed
Lines changed: 37 additions & 0 deletions
File tree
- Modules/_testinternalcapi
- Python
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1135 | 1135 | | |
1136 | 1136 | | |
1137 | 1137 | | |
| 1138 | + | |
1138 | 1139 | | |
1139 | 1140 | | |
1140 | 1141 | | |
| |||
1413 | 1414 | | |
1414 | 1415 | | |
1415 | 1416 | | |
| 1417 | + | |
1416 | 1418 | | |
1417 | 1419 | | |
1418 | 1420 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments