pyo3
pyo3 copied to clipboard
Rust bindings for the Python interpreter
Alternative implementation for #4987 as of comment https://github.com/PyO3/pyo3/pull/4987#issuecomment-2730985716.
Using `#[allow(clippy::useless_conversion)]` still causes failures if the PyO3 user uses `#[forbid(clippy::useless_conversion)]`. Instead we can ensure the `into` call is not within a `quote_spanned!` block, allowing clippy to know this is...
For example, with a mutex. This also leaves open the possibility for users to add their own `Sync` implementations if they want to manage e.g. an `UnsafeCell` themselves. This provides...
[`create_exception`](https://docs.rs/pyo3/latest/pyo3/macro.create_exception.html) allows taking a `base`, which the new exception subclasses from. Is there some way to create a new exception which uses multiple inheritance from two parents?
I defined a class ```rust #[pyclass(get_all)] class MyClass { inner: Arc, } ``` and I got the error below ```bash `std::sync::Arc` cannot be converted to a Python objec ```
I'm not even sure whether to use a venv or not and how, it doesn't say.
https://pyo3.rs/v0.14.5/building_and_distribution#minimum-python-version-for-abi3 >Note: If you set more that one of these api version feature flags the highest version always wins. For example, with both abi3-py36 and abi3-py38 set, PyO3 would build...
In free-threaded Python, to_vec needs to make sure to run inside a critical section so that no other Python thread is mutating the bytearray causing UB. See also https://github.com/PyO3/pyo3/issues/4736 Unfortunately...
### Bug Description I can annotate a complex enum as #[pyclass(get_all, set_all)], but set_all does not work. It should either work or be rejected during compilation. ### Steps to Reproduce...
### Bug Description I started adding text_signature annotations to my python module, in order to offer better support for IDEs. When trying to read back my new annotations with `inspect.signature()`,...