Evaluation stack bounds are not checked in debug builds. #120982
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-bug
An unexpected behavior, bug, or error
Bug report
Bug description:
Prior to the generating code for the interpreter(s), we had a set of macros for stack manipulation,
PUSH
,POP
, etc.The code generator does not use these any more, which improves readability, but we have lost the runtime checking of bounds.
Having those bounds checks would have identified the issue with #120793 almost immediately.
We should add bounds checking asserts in the generated code.
E.g.
stack_pointer +=1
should beThis bulks out the generated code a bit, but I think making the limit checks explicit is more readable than using stack adjustment macros.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: