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-138045: Fix importing numpy in legacy subinterpreters by skipping switch to main interpreter when not needed by jan-hasse · Pull Request #142979 · python/cpython

Conversation

@jan-hasse

@jan-hasse jan-hasse commented Dec 19, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown

(singlephase == NULL) check in update_global_state_for_extension could be removed because it's only called with pointers to stack objects.

I've tried creating a minimal working reproducer instead of importing numpy with the example from #138045 (comment) but didn't manage to integrate that into Python's test suite. Maybe someone else has more knowledge on how to create a simple test that reproduce the numpy situation.

The fix can be backported down to 3.13.

  • Issue: Python 3.13 breaks circular imports through single-phase extension modules using non-isolated subinterpreters #138045

Sorry, something went wrong.

Uh oh!

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

All reactions
@jan-hasse
jan-hasse requested review from brettcannon, ericsnowcurrently, kumaraditya303, ncoghlan and warsaw as code owners December 19, 2025 14:22
@python-cla-bot

python-cla-bot Bot commented Dec 19, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app

bedevere-app Bot commented Dec 19, 2025

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot added the awaiting review label Dec 19, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Dec 19, 2025
Python 3.13 breaks circular imports through single-phase extension modules using non-isolated subinterpreters #138045
Closed
ZeroIntensity
ZeroIntensity reviewed Dec 19, 2025
View reviewed changes

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

Please add a news entry, and ideally a test case. This seems difficult to test, though. You could look into adding something to _testsinglephase.

Sorry, something went wrong.

Uh oh!

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

All reactions
@brettcannon
brettcannon removed their request for review December 19, 2025 18:18
@kumaraditya303
kumaraditya303 removed their request for review December 29, 2025 11:40
@jan-hasse
pythongh-138045: Fix importing numpy in legacy subinterpreters by ski…
6f371d0
…pping switch to main interpreter when not needed

(singlephase == NULL) check in update_global_state_for_extension could be removed because it's only called with pointers to stack objects.
@jan-hasse
jan-hasse force-pushed the fix-issue-138045 branch from ccbd2b9 to 6f371d0 Compare January 2, 2026 09:09
@jan-hasse

jan-hasse commented Jan 2, 2026

Copy link
Copy Markdown
Author

Added a news entry. I was not able to implement a test, I already looked at _testsinglephase but wasn't able to setup something similar to numpy :(

ZeroIntensity reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@jan-hasse jan-hasse mentioned this pull request Feb 10, 2026
Extensions that raise exceptions in their PyInit* cause a crash in subinterpreters #144601
Closed
@ZeroIntensity

ZeroIntensity commented Feb 16, 2026

Copy link
Copy Markdown
Member

Thanks for the contribution. See my comment -- this was already fixed by #144602.

jan-hasse reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@ZeroIntensity ZeroIntensity closed this Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ZeroIntensity ZeroIntensity ZeroIntensity left review comments
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@ncoghlan ncoghlan Awaiting requested review from ncoghlan ncoghlan is a code owner
@warsaw warsaw Awaiting requested review from warsaw warsaw is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

awaiting review

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

@jan-hasse @ZeroIntensity
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.