-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Background
PyO3's gil-refs feature (used via &PyModule in lib.rs) is deprecated as of PyO3 0.21 and was removed in PyO3 0.23+. We currently pin to PyO3 0.22 which still supports gil-refs but emits deprecation warnings during compilation.
What needs to change
In src/lib.rs, the module function signature uses the old GIL-ref pattern:
#[pymodule]
fn schematodes(_py: Python, m: &PyModule) -> PyResult<()> {This needs to be migrated to the Bound API:
#[pymodule]
fn schematodes(m: &Bound<'_, PyModule>) -> PyResult<()> {The wrap_pyfunction! and m.add_class calls may also need minor updates.
Why
- Allows upgrading to PyO3 0.23+ (latest is 0.28+)
- Removes deprecation warnings during build
- Keeps schematodes compatible with future Rust/PyO3 ecosystem
Deprecation warnings from current build
warning: use of deprecated method `pyo3::deprecations::GilRefs::<T>::function_arg`: use `&Bound<'_, T>` instead for this function argument
warning: use of deprecated constant: this function has implicit defaults for the trailing `Option<T>` arguments
References
- PyO3 migration guide
- Related: Build fails on Python 3.13: subprocess-exited-with-error when building wheel #8 (Python 3.13 support via PyO3 0.22)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels