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-84436: Improve Immortalization for Builtin Types by ericsnowcurrently · Pull Request #103823 · python/cpython

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently commented Apr 25, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

We do two things here: immortalize the builtin structseq types, and immortalize tp_dict, tp_bases, and tp_mro for builtin types. This is necessary for a per-interpreter GIL.

Note that we could also take the approach to immortalization that no immortal object should ever be freed, even if allocated dynamically. That's something we'll sort out as soon as we can. In the meantime, the change here takes care of isolation concerns.

  • Issue: Fixing Copy on Writes from reference counting and immortal objects #84436

Sorry, something went wrong.

Uh oh!

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

All reactions
@ericsnowcurrently
Immortalize in _PyStructSequence_InitBuiltinWithFlags().
d23861b
@ericsnowcurrently ericsnowcurrently added the skip news label Apr 25, 2023
@bedevere-bot bedevere-bot mentioned this pull request Apr 25, 2023
Fixing Copy on Writes from reference counting and immortal objects #84436
Closed
@bedevere-bot bedevere-bot added the awaiting core review label Apr 25, 2023
ericsnowcurrently added 5 commits April 25, 2023 12:36
@ericsnowcurrently
Un-initialize the builtin structseq types.
00e714a
@ericsnowcurrently
Immortalize tp_dict, tp_bases, and tp_mro for builtin static types.
c3d292c
@ericsnowcurrently
Do the work in _PyStaticType_InitBuiltin().
018ee57
@ericsnowcurrently
Add _Py_EnsureImmortal() and _Py_ImmortalObjectsFini().
1d1393a
@ericsnowcurrently
Recursively immortalize.
3eebdff
@ericsnowcurrently
ericsnowcurrently force-pushed the immortalized-objects branch from 73aeea1 to 3eebdff Compare April 25, 2023 18:42
@ericsnowcurrently ericsnowcurrently changed the title gh-84436: Immortalized Objects gh-84436: Improve Immortalization for Builtin Types Apr 25, 2023
@ericsnowcurrently ericsnowcurrently mentioned this pull request Apr 25, 2023
gh-84436: Immortalize in _PyStructSequence_InitBuiltinWithFlags() #103817
Closed
@ericsnowcurrently ericsnowcurrently added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 25, 2023
@ericsnowcurrently ericsnowcurrently mentioned this pull request Apr 27, 2023
gh-94673: More Per-Interpreter Fields for Builtin Static Types #103912
Merged
ericsnowcurrently added a commit that referenced this pull request May 3, 2023
@ericsnowcurrently
gh-94673: More Per-Interpreter Fields for Builtin Static Types (gh-10…
de64e75
…3912)

his involves moving tp_dict, tp_bases, and tp_mro to PyInterpreterState, in the same way we did for tp_subclasses.  Those three fields are effectively const for builtin static types (unlike tp_subclasses).  In theory we only need to make their values immortal, along with their contents.  However, that isn't such a simple proposition.  (See gh-103823.)  In the meantime the simplest solution is to move the fields into the interpreter.

One alternative is to statically allocate the values, but that's its own can of worms.
@zware zware removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 5, 2023
@github-actions

github-actions Bot commented Apr 12, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 12, 2026
@ambv

ambv commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

This PR is attached to gh-84436, which is already completed: the fix for that issue landed through other changes, and this PR's approach was not taken or has since become obsolete. Closing to cull the number of open pull requests. Do not reopen this pull request without getting a go-ahead from a triager or core developer.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ambv ambv closed this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ZeroIntensity ZeroIntensity Awaiting requested review from ZeroIntensity ZeroIntensity will be requested when the pull request is marked ready for review ZeroIntensity is a code owner
@FFY00 FFY00 Awaiting requested review from FFY00 FFY00 will be requested when the pull request is marked ready for review FFY00 is a code owner
@markshannon markshannon Awaiting requested review from markshannon markshannon will be requested when the pull request is marked ready for review markshannon is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

awaiting core review skip news stale Stale PR or inactive for long period of time.

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.

4 participants

@ericsnowcurrently @ambv @zware @bedevere-bot
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.