pyo3
pyo3 copied to clipboard
Rust bindings for the Python interpreter
Python supports unpacking all objects which support the `Sequence` protocol. I believe it does so by simply calling `__getitem__` for consecutive integer indices. Currently in PyO3 only tuple objects can...
### Discussed in https://github.com/PyO3/pyo3/discussions/5479 Originally posted by **ffuugoo** September 30, 2025 When using `#[pyclass]` on a "complex" enum, PyO3 generates a sub-class for each variant, so that you can use...
(Followup to #5531) This is no longer needed on MSRV 1.83, as `c""` literals are now available on all supported Rust versions.
### Bug Description When running `cargo test` I encounter the following error: ``` Could not find platform independent libraries Could not find platform dependent libraries Fatal Python error: Failed to...
In python the convention is to compare enums by identity (`Enum.A is Enum.A` and `Enum.A is not Enum.B`) instead of equality (`Enum.A == Enum.A` and `Enum.A != Enum.B`). However, a...
### Bug Description We're using PyO3 for [Zensical](github.com/zensical/zensical) and get a segmentation fault which seems to be related to the cleanup of thread locals. Specifically, calling `torch.set_default_device("cpu")` triggers the issue....
This is to track test failures caused when compiling against 3.15. I know it's a bit early (even contradicting _my own advice_ in `CONTRIBUTING.md`), but the sooner they're fixed before...
``` Finished `test` profile [unoptimized + debuginfo] target(s) in 0.18s Running tests/test_module.rs (target/debug/deps/test_module-500b4c594cd8be90) running 13 tests SystemError: invalid PyModuleDef, extension possibly compiled for non-free-threaded Python SystemError: invalid PyModuleDef, extension possibly...
``` Finished `test` profile [unoptimized + debuginfo] target(s) in 0.18s Running tests/test_module.rs (target/debug/deps/test_module-500b4c594cd8be90) running 13 tests SystemError: invalid PyModuleDef, extension possibly compiled for non-free-threaded Python SystemError: invalid PyModuleDef, extension possibly...
``` Finished `test` profile [unoptimized + debuginfo] target(s) in 0.07s Running tests/test_declarative_module.rs (target/debug/deps/test_declarative_module-5e472faf94888739) running 4 tests SystemError: invalid PyModuleDef, extension possibly compiled for non-free-threaded Python test test_declarative_module ... FAILED SystemError:...