Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Evaluation stack bounds are not checked in debug builds. #120982

Copy link
Copy link
@markshannon

Description

@markshannon
Issue body actions

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 be

stack_pointer += 1;
assert(WITH_STACK_BOUNDS(stack_pointer));

This 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

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.