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

gh-136421: Fix crash when _datetime is been initialized in multiple sub-interpreters#136422

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

Open
aisk wants to merge5 commits intopython:main
base:main
Choose a base branch
Loading
fromaisk:datetime-subinterpreter-initialize

Conversation

aisk
Copy link
Member

@aiskaisk commentedJul 8, 2025
edited by bedevere-appbot
Loading

@aiskaisk changed the titlegh-136421: Fix crash when _datetime is been initialized in multiple sub-interpre…gh-136421: Fix crash when _datetime is been initialized in multiple sub-interpretersJul 8, 2025
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.

I think we need a more fundamental fix that prevents static types from being initialized concurrently. This is sort of a known issue, see#129817.

@bedevere-app
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

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.

Please add a test. I'm still not fully convinced that this is the right approach;_PyStaticType_InitForExtension should be thread-safe on its own, or at least in the places where it's used.

I think the problem is that_datetime is special and has static types (because they need to be exposed via the capsule). Instead of initializing them in the module's execution function, let's do it during interpreter initialization inpycore_interp_init.

…e-136421.uzieFA.rstCo-authored-by: Peter Bierma <zintensitydev@gmail.com>
@neonene
Copy link
Contributor

An alternative would be to make_interpreters module import_datetime when running the main interpreter.

@aisk
Copy link
MemberAuthor

Due to issue#136423, importing _datetime into a sub-interpreter concurrently still results in a crash, even after this change, so it's hard to write a test. I also feel that this is not the correct way to fix the root cause, and this PR is more like a workaround.

I'll continue to investigate#136423, as they appear to have the same root cause. Maybe we can find a better way to address them. So maybe we can wait sometime before continue this PR?

@ZeroIntensity
Copy link
Member

I've put up#136583 as an alternative that avoids locking, at the cost of moving_datetime to a static library.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka left review comments

@ZeroIntensityZeroIntensityZeroIntensity requested changes

@neoneneneoneneneonene left review comments

@pgansslepganssleAwaiting requested review from pgansslepganssle is a code owner

@abalkinabalkinAwaiting requested review from abalkinabalkin is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@aisk@neonene@ZeroIntensity@serhiy-storchaka

[8]ページ先頭

©2009-2025 Movatter.jp