Skip to content

Conversation

@markshannon
Copy link
Member

@markshannonmarkshannon commented Apr 14, 2025

This PR lifts the restriction on the modification of input and "peek" variables.

This restriction was supposed to help avoid reference leaks, but actually just makes it annoying and inefficient to change values on the stack.
Plus, we have a better way to detect leaks on the stack: Py_STACKREF_DEBUG.

Doing this allows us to clean up some code and, more importantly for TOS caching, turn some arrays back into scalars.

This PR modifies SWAP and _MAKE_CALLARGS_A_TUPLE to demonstrate the simplification.
We can make further simplifications, but I'll save those for an other PR for ease of review.

@markshannonmarkshannon merged commit 844596c into python:mainApr 14, 2025
79 checks passed
@markshannonmarkshannon deleted the allow-modification-peek-variables branch April 14, 2025 11:19
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@markshannon@iritkatriel