Bug report
Bug description:
The race condition is more easily noticed if site.py takes a while to execute as the internal "initialized" flag is set to 1 before the site 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 document Py_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
Linked PRs
Bug report
Bug description:
The race condition is more easily noticed if
site.pytakes a while to execute as the internal "initialized" flag is set to 1 before thesiteimport.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 document
Py_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
Linked PRs