Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.3k
Open
Description
Bug report
Bug description:
The race condition is more easily noticed ifsite.py takes a while to execute as the internal "initialized" flag is set to 1 before thesite import.
Example impact? PyO3 has to jump through some hoops to avoid problems here in embedding scenarios where multiple threads all want to use an interpreter (most often test suites, resulting in some flaky tests).PyO3/pyo3#5903
We documentPy_IsInitialized() as safe to call at any time and as being accurate. It is technically safe, but it isn't currently accurate.
CPython versions tested on:
3.13, 3.14, 3.15-alpha