Skip to content

gh-136421: Load _datetime static types during interpreter initialization#136583

Merged
ZeroIntensity merged 15 commits intopython:mainfrom
ZeroIntensity:datetime-interp-init
Jul 21, 2025
Merged

gh-136421: Load _datetime static types during interpreter initialization#136583
ZeroIntensity merged 15 commits intopython:mainfrom
ZeroIntensity:datetime-interp-init

Conversation

@ZeroIntensity
Copy link
Member

@ZeroIntensity ZeroIntensity commented Jul 12, 2025

_datetime is a special module, because it's the only non-builtin C extension that contains static types. As such, it would initialize static types in the module's execution function, which can run concurrently. Since static type initialization is not thread-safe, this caused crashes. This fixes it by moving the initialization of _datetime's static types to interpreter startup (where all other static types are initialized), which is already properly protected through other locks.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants