GILGuard::acquire() cannot be called during multi-phase Python
interpreter initialization because it calls Py_IsInitialized(),
which doesn't report the interpreter as initialized until all
phases of initialization have completed.
PyOxidizer uses the multi-phase initialization API and needs to
interact with pyo3's high-level APIs (not the FFI bindings) after
partial interpreter initialization, before the interpreter is fully
initialized. Attempts to use GILGuard::acquire() result in a panic
due to the aforementioned Py_IsInitialized() check failing.
This commit refactors the GILGuard logic into a function that
obtains the actual GILGuard and another function to perform
checks before calling the aforementioned functions.
A new unsafe `Python::with_gil_unchecked()` has been defined
to acquire the GIL via the unchecked code path so we may obtain
a `Python` during multi-phase initialization (and possibly other
scenarios).
* Add support to IndexMap
* Fix indexmap version to 1.6.2
* Remove code duplication by mistake
* Fix ambiguity in test
* Minor change for doc.rs
* Add to lib.rs docstring
* Add indexmap to conversion table
* Add indexmap flag in docs.rs action
* Add indexmap feature to CI
* Add note in changelog
* Use with_gil in tests
* Move code to src/conversions/indexmap.rs
* Add PR number to CHANGELOG
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
* Add round trip test
* Fix issue in MSRV Ubuntu build
* Fix Github workflow syntax
* Yet Another Attempt to Fix MSRV Ubuntu build
* Specify hashbrown to avoid ambiguity in CI
* Add suggestions
* More flexible version for indexmap
* Add documentation
* Address PR comments
* Export indexmap for docs
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
If we got more then one file, only take those that contain the arch name.
For ubuntu 20.04 with host architecture x86_64 and a foreign architecture of armhf
this reduces the number of candidates to 1:
$ find /usr/lib/python3.8/ -name '_sysconfigdata*.py' -not -lname '*'
/usr/lib/python3.8/_sysconfigdata__x86_64-linux-gnu.py
/usr/lib/python3.8/_sysconfigdata__arm-linux-gnueabihf.py
CHANGELOG.md: add entry for cross-sysconfigdata filter on arch
commit changelog:
1. initial
2. if filtered list is empty, use pre filtered.
3. clippy is_empty and cloned