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

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

Merged
markshannon merged 1 commit into
python:mainpython/cpython:mainfrom
faster-cpython:allow-modification-peek-variablesfaster-cpython/cpython:allow-modification-peek-variablesCopy head branch name to clipboard
Apr 14, 2025
Merged

GH-131498: Allow 'peek' variables to be modified#132506
markshannon merged 1 commit into
python:mainpython/cpython:mainfrom
faster-cpython:allow-modification-peek-variablesfaster-cpython/cpython:allow-modification-peek-variablesCopy head branch name to clipboard

Conversation

@markshannon

@markshannon markshannon commented Apr 14, 2025

Copy link
Copy Markdown
Member

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

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