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-125174: Make immortal objects more robust, following design from PEP 683 by markshannon · Pull Request #125251 · python/cpython

Conversation

@markshannon

@markshannon markshannon commented Oct 10, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member
  • Issue: "Immortal" objects aren't immortal and that breaks things. #125174

Sorry, something went wrong.

Uh oh!

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

All reactions
@markshannon
Make immortal objects more robust, following design in PEP 683
e932334
@markshannon
markshannon requested review from 1st1, asvetlov, gvanrossum, kumaraditya303, methane and willingc as code owners October 10, 2024 11:00
@bedevere-app bedevere-app Bot mentioned this pull request Oct 10, 2024
"Immortal" objects aren't immortal and that breaks things. #125174
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Oct 10, 2024
@markshannon
Add news
94f8fd0
@markshannon

markshannon commented Oct 10, 2024

Copy link
Copy Markdown
Member Author

This is not a complete fix for #125174, just enough to unblock other work

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon markshannon added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Oct 10, 2024
@bedevere-bot

bedevere-bot commented Oct 10, 2024

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @markshannon for commit 94f8fd0 🤖

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Oct 10, 2024
@markshannon
Remove last uses of _Py_IsImmortalLoose
9f86e46
@markshannon

markshannon commented Oct 10, 2024

Copy link
Copy Markdown
Member Author

The two "failing" refleak buildbots seem to be hanging in test.test_concurrent_futures.test_shutdown. There are no reported refleaks.

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon

markshannon commented Oct 10, 2024

Copy link
Copy Markdown
Member Author

Performance impact:

Overall a small slowdown, with a large 7-10% slowdown on nbody.
This is almost certainly due to the regression in stack spilling around _Py_IsImmortal_Loose fixed here.

ARM 64 darwin
x86-64 linux

I'll re-run the linux benchmarks with the fix as a sanity check.

All reactions

Sorry, something went wrong.

Uh oh!

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

iritkatriel
iritkatriel reviewed Oct 10, 2024
View reviewed changes
Comment thread Include/refcount.h Resolved

Uh oh!

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

@markshannon
Fixup comment
9c76c52
iritkatriel
iritkatriel approved these changes Oct 10, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Oct 10, 2024
@markshannon

markshannon commented Oct 10, 2024

Copy link
Copy Markdown
Member Author

Windows shows an over 2% improvement. With the regression fixed, this I would expect this to be more than 3%.

This reason for this is that the MSVC does not convert unsigned int x; x > (1 << 31) into signed x; x < 0 as do clang and gcc.
This PR uses the signed x; x < 0 form. Hence the speedup.

mdboom reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

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

@gvanrossum
gvanrossum removed request for asvetlov and gvanrossum October 10, 2024 16:26
@markshannon

markshannon commented Oct 10, 2024

Copy link
Copy Markdown
Member Author

x86-64 linux performance numbers are a bit noisy, but show no significant change.

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon
markshannon merged commit c901437 into python:main Oct 10, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Oct 10, 2024
@markshannon
markshannon deleted the more-robust-immortality branch October 10, 2024 17:20
tacaswell added a commit to tacaswell/msgspec that referenced this pull request Oct 24, 2024
@tacaswell
MNT: account for CPython 314 changes
93e131c
python/cpython#125251 renamed
_PY_IMMORTAL_REFCNT -> _PY_IMMORTAL_INITIAL_REFCNT
@tacaswell tacaswell mentioned this pull request Oct 24, 2024
MNT: account for CPython 314 changes msgspec/msgspec#760
Merged
jcrist added a commit to msgspec/msgspec that referenced this pull request Oct 24, 2024
@tacaswell @jcrist
MNT: account for CPython 314 changes (#760)
f66bbbd
* MNT: account for CPython 314 changes

python/cpython#125251 renamed
_PY_IMMORTAL_REFCNT -> _PY_IMMORTAL_INITIAL_REFCNT

* Define new macro to reduce duplication

---------

Co-authored-by: Jim Crist-Harif <[email protected]>
@ZeroIntensity ZeroIntensity mentioned this pull request Nov 24, 2024
gh-127119: Remove check on accidental deallocation of immortal objects for free-threaded build #127120
Closed
@markshannon markshannon mentioned this pull request Dec 10, 2024
GH-125174: Mark objects as statically allocated. #127797
Merged
@ZeroIntensity ZeroIntensity mentioned this pull request Jan 5, 2025
Add an API for determining if an object is immortal #128509
Closed
akretz added a commit to akretz/iteration_utilities that referenced this pull request Dec 4, 2025
@akretz
Python 3.14 uses _Py_IMMORTAL_INITIAL_REFCNT
eb154c9
see python/cpython#125251
akretz added a commit to akretz/iteration_utilities that referenced this pull request Dec 4, 2025
@akretz
Python 3.14 uses _Py_IMMORTAL_INITIAL_REFCNT
5f3f81c
see python/cpython#125251
@akretz akretz mentioned this pull request Dec 4, 2025
Python 3.14 MSeifert04/iteration_utilities#347
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iritkatriel iritkatriel iritkatriel approved these changes
@kumaraditya303 kumaraditya303 Awaiting requested review from kumaraditya303 kumaraditya303 is a code owner
@methane methane Awaiting requested review from methane methane is a code owner
@1st1 1st1 Awaiting requested review from 1st1 1st1 is a code owner
@willingc willingc Awaiting requested review from willingc willingc is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

3 participants

@markshannon @bedevere-bot @iritkatriel
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.