Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add notes on nogil & reinitialization to the Opt-Out section in Module Isolation HOWTO#134141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
encukou merged 2 commits intopython:mainfromencukou:isolating-opt-out
May 22, 2025

Conversation

encukou
Copy link
Member

@encukouencukou commentedMay 17, 2025
edited by github-actionsbot
Loading

Copy link
Member

@ZeroIntensityZeroIntensity left a comment

Choose a reason for hiding this comment

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

Doesn't free-threading perform a stop-the-world when importing modules?

@encukou
Copy link
MemberAuthor

A better question is: do we guarantee that it willalways stop the world?

@colesbury
Copy link
Contributor

colesbury commentedMay 17, 2025
edited
Loading

We stop the world, temporarily enable the GIL, then resume (but with only one thread now holding the GIL), and the run the C extension initialization code.

I think you might still need the locks in this example because of isolated sub interpreters each with their own GIL.

We haven't explicitly guaranteed the stop the world behavior, but it'll probably be difficult to change in the future.

@ZeroIntensity
Copy link
Member

I think you might still need the locks in this example because of isolated sub interpreters each with their own GIL.

Subinterpreters switch to the main interpreter to import an extension, so the GIL synchronizes it.

@encukou
Copy link
MemberAuthor

Subinterpreters switch to the main interpreter to import an extension, so the GIL synchronizes it.

Well, that's something I'd like to change for 3.15 :)

Let's play it safe and keep our options open?
If you know the current implementation details, it's easy to leave this out.

@ZeroIntensity
Copy link
Member

I'll yield, but I'm worried that it would break too much code to be feasible (or worth doing). I think all third-party extensions currently assume no other threads, right? Maybe we could make this opt-in.

encukou reacted with thumbs up emoji

@encukouencukou merged commit1f0a294 intopython:mainMay 22, 2025
24 checks passed
@github-project-automationgithub-project-automationbot moved this fromTodo toDone inDocs PRsMay 22, 2025
@encukouencukou deleted the isolating-opt-out branchMay 22, 2025 07:36
@encukouencukou added needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsMay 22, 2025
@miss-islington-app
Copy link

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

@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 22, 2025
…e Isolation HOWTO (pythonGH-134141)(cherry picked from commit1f0a294)Co-authored-by: Petr Viktorin <encukou@gmail.com>Co-authored-by: Sam Gross <colesbury@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 22, 2025
…e Isolation HOWTO (pythonGH-134141)(cherry picked from commit1f0a294)Co-authored-by: Petr Viktorin <encukou@gmail.com>Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-app
Copy link

GH-134491 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelMay 22, 2025
@bedevere-app
Copy link

GH-134492 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelMay 22, 2025
encukou added a commit that referenced this pull requestMay 22, 2025
…n Module Isolation HOWTO (GH-134141) (GH-134492)Add notes on nogil & reinitialization to the Opt-Out section in Module Isolation HOWTO (GH-134141)(cherry picked from commit1f0a294)Co-authored-by: Petr Viktorin <encukou@gmail.com>Co-authored-by: Sam Gross <colesbury@gmail.com>
encukou added a commit that referenced this pull requestMay 23, 2025
…n Module Isolation HOWTO (GH-134141) (GH-134491)Add notes on nogil & reinitialization to the Opt-Out section in Module Isolation HOWTO (GH-134141)(cherry picked from commit1f0a294)Co-authored-by: Petr Viktorin <encukou@gmail.com>Co-authored-by: Sam Gross <colesbury@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@colesburycolesburycolesbury left review comments

@ZeroIntensityZeroIntensityZeroIntensity left review comments

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrently

Assignees
No one assigned
Labels
docsDocumentation in the Doc dirskip issueskip newstopic-C-API
Projects
Status: Done
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@encukou@colesbury@ZeroIntensity

[8]ページ先頭

©2009-2025 Movatter.jp