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-113433: Automatically Clean Up Subinterpreters in Py_Finalize() by ericsnowcurrently · Pull Request #121060 · python/cpython

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently commented Jun 26, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This change makes things a little less painful for some users. It also fixes a failing assert (gh-120765), by making sure all subinterpreters are destroyed before the main interpreter. As part of that, we make sure Py_Finalize() always runs with the main interpreter active.

Some of the changes for gh-120838 build on this.

  • Issue: Crash of interpreter due to unclosed sub-interpreters #113433

Sorry, something went wrong.

Uh oh!

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

All reactions
ericsnowcurrently added 2 commits June 26, 2024 13:45
@ericsnowcurrently
Factor out resolve_final_tstate() and _Py_Finalize().
df63d15
@ericsnowcurrently
Make sure the main interpreter is active in _Py_Finalize().
f6df8be
@bedevere-app bedevere-app Bot mentioned this pull request Jun 26, 2024
Crash of interpreter due to unclosed sub-interpreters #113433
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Jun 26, 2024
@ericsnowcurrently ericsnowcurrently added needs backport to 3.13 only security fixes and removed awaiting core review labels Jun 26, 2024
@ericsnowcurrently
Add a NEWS entry.
071d270
@ericsnowcurrently ericsnowcurrently mentioned this pull request Jun 26, 2024
gh-120838: Make Sure Py_Finalize() Always Runs Against the Main Interpreter #121063
Closed
@ericsnowcurrently
ericsnowcurrently enabled auto-merge (squash) June 26, 2024 20:47
ericsnowcurrently added 5 commits June 26, 2024 14:49
@ericsnowcurrently
Clean up all remaining subinterpreters.
ccb3aa2
@ericsnowcurrently
Finalize subinterpreters *after* running pending calls and atexit hooks.
6b26e0a
@ericsnowcurrently
Make sure there's only one tstate left.
74f4ed0
@ericsnowcurrently
Add a NEWS entry.
02a969a
@ericsnowcurrently
Clean up subinterpreters only after modules (incl. __main__) have bee…
86cd3dd
…n cleaned up.
@ericsnowcurrently
ericsnowcurrently force-pushed the clean-up-subinterpreters branch from 04828ac to 86cd3dd Compare June 26, 2024 20:49
@ericsnowcurrently
ericsnowcurrently merged commit 4be1f37 into python:main Jun 26, 2024
@miss-islington-app

miss-islington-app Bot commented Jun 26, 2024

Copy link
Copy Markdown

Thanks @ericsnowcurrently for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 26, 2024
@ericsnowcurrently @miss-islington
pythongh-113433: Automatically Clean Up Subinterpreters in Py_Finaliz…
8c13544
…e() (pythongh-121060)

This change makes things a little less painful for some users.  It also fixes a failing assert (pythongh-120765), by making sure all subinterpreters are destroyed before the main interpreter.  As part of that, we make sure Py_Finalize() always runs with the main interpreter active.
(cherry picked from commit 4be1f37)

Co-authored-by: Eric Snow <[email protected]>
@ericsnowcurrently
ericsnowcurrently deleted the clean-up-subinterpreters branch June 26, 2024 21:17
@bedevere-app

bedevere-app Bot commented Jun 26, 2024

Copy link
Copy Markdown

GH-121067 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Jun 26, 2024
ericsnowcurrently added a commit that referenced this pull request Jun 26, 2024
@miss-islington @ericsnowcurrently
[3.13] gh-113433: Automatically Clean Up Subinterpreters in Py_Finali…
c839974
…ze() (gh-121067)

This change makes things a little less painful for some users.  It also fixes a failing assert (gh-120765), by making sure all subinterpreters are destroyed before the main interpreter.  As part of that, we make sure Py_Finalize() always runs with the main interpreter active.

(cherry picked from commit 4be1f37, AKA gh-121060)

Co-authored-by: Eric Snow <[email protected]>
mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
@ericsnowcurrently @mrahtz
pythongh-113433: Automatically Clean Up Subinterpreters in Py_Finaliz…
7aa0f5d
…e() (pythongh-121060)

This change makes things a little less painful for some users.  It also fixes a failing assert (pythongh-120765), by making sure all subinterpreters are destroyed before the main interpreter.  As part of that, we make sure Py_Finalize() always runs with the main interpreter active.
This was referenced Jul 8, 2024
[subinterpreters] Lingering subinterpreters should be implicitly cleared on shutdown #80406
Closed
Check for sub interpreter support is not catching readline global state and crashing #112292
Closed
[subinterpreters] Multiple interpreters and readline module hook functions. #48452
Closed
Some builtin single phase modules do get loaded into subinterpreters which do not support them #119450
Closed
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
@ericsnowcurrently @estyxx
pythongh-113433: Automatically Clean Up Subinterpreters in Py_Finaliz…
1a151b0
…e() (pythongh-121060)

This change makes things a little less painful for some users.  It also fixes a failing assert (pythongh-120765), by making sure all subinterpreters are destroyed before the main interpreter.  As part of that, we make sure Py_Finalize() always runs with the main interpreter active.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

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.

1 participant

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