GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-148871: make `LOAD_COMMON_CONSTANT` use immortal stackref borrows by NekoAsakura · Pull Request #149625 · python/cpython

Conversation

@NekoAsakura

@NekoAsakura NekoAsakura commented May 9, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

gc.is_tracked(all/any) True -> False

  • Issue: Extend and improve LOAD_COMMON_CONSTANT #148871

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@NekoAsakura
pythongh-148871: make LOAD_COMMON_CONSTANT use immortal stackref bo…
05618aa
…rrows
@NekoAsakura
NekoAsakura requested review from FFY00, Fidget-Spinner, ZeroIntensity, ericsnowcurrently, iritkatriel, markshannon, savannahostrowski and tomasr8 as code owners May 9, 2026 23:42
@bedevere-app bedevere-app Bot mentioned this pull request May 9, 2026
Extend and improve LOAD_COMMON_CONSTANT #148871
Open
@bedevere-app bedevere-app Bot added the awaiting review label May 9, 2026
markshannon
markshannon reviewed May 19, 2026
View reviewed changes
Comment thread Python/bytecodes.c Outdated
// Keep in sync with _common_constants in opcode.py
assert(oparg < NUM_COMMON_CONSTANTS);
value = PyStackRef_FromPyObjectNew(tstate->interp->common_consts[oparg]);
value = PyStackRef_DUP(tstate->interp->common_consts[oparg]);

@markshannon markshannon May 19, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to check the tag.

Could you add PyStackRef_DupImmortal(ref) which would return its argument unchanged and assert that the referenced object is immortal, otherwise it defeats the point of changing PyObject * to _PyStackRef here

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
markshannon
markshannon reviewed May 19, 2026
View reviewed changes
Comment thread Python/flowgraph.c Outdated
if (opcode == LOAD_COMMON_CONSTANT) {
assert(oparg < NUM_COMMON_CONSTANTS);
return Py_NewRef(_PyInterpreterState_GET()->common_consts[oparg]);
return Py_NewRef(PyStackRef_AsPyObjectBorrow(

@markshannon markshannon May 19, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return Py_NewRef(PyStackRef_AsPyObjectBorrow(
return PyStackRef_AsPyObjectBorrow(

These objects are immortal, you can borrow references to them.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@NekoAsakura

NekoAsakura commented May 20, 2026

Copy link
Copy Markdown
Member Author

Thanks for reviewing :')
Unfortunately I cannot get on my remote server right now due to some network issues, but I’ll sort the requested changes tomorrow.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@NekoAsakura
address feedback
41dd028
@NekoAsakura NekoAsakura added the skip news label May 20, 2026
NekoAsakura added 4 commits May 21, 2026 08:29
@NekoAsakura
Merge branch 'main' into pythongh-148871-immortal-stackref
d81f9b6
@NekoAsakura
fix merge conflict
e142095
@NekoAsakura
Merge branch 'main' into pythongh-148871-immortal-stackref
0cf0de2
@NekoAsakura
Merge branch 'main' into pythongh-148871-immortal-stackref
9bbbb46
@markshannon
markshannon self-requested a review May 28, 2026 10:16
markshannon
markshannon approved these changes May 28, 2026
View reviewed changes

@markshannon markshannon left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks for doing this

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels May 28, 2026
@markshannon
markshannon merged commit 39bd44f into python:main May 28, 2026
105 of 106 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label May 28, 2026
@NekoAsakura
NekoAsakura deleted the gh-148871-immortal-stackref branch May 28, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markshannon markshannon markshannon approved these changes
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@ZeroIntensity ZeroIntensity Awaiting requested review from ZeroIntensity ZeroIntensity is a code owner
@FFY00 FFY00 Awaiting requested review from FFY00 FFY00 is a code owner
@tomasr8 tomasr8 Awaiting requested review from tomasr8 tomasr8 is a code owner
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner Fidget-Spinner is a code owner
@savannahostrowski savannahostrowski Awaiting requested review from savannahostrowski
@iritkatriel iritkatriel Awaiting requested review from iritkatriel iritkatriel is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@NekoAsakura @markshannon
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.