Skip to content

GH-131498: Allow 'peek' variables to be modified #132506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

markshannon
Copy link
Member

@markshannon markshannon 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.

@markshannon markshannon merged commit 844596c into python:main Apr 14, 2025
79 checks passed
@markshannon markshannon deleted the allow-modification-peek-variables branch April 14, 2025 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy