🐛 Pin pyo3 to 0.27.1 and pyo3-stub-gen to 0.21.0#115
Merged
pierre-rouanet merged 1 commit intoMay 26, 2026
Conversation
pierre-rouanet
self-requested a review
May 26, 2026 14:12
pierre-rouanet
requested changes
May 26, 2026
Member
There was a problem hiding this comment.
Hi @jurmy24,
Thanks again for the contribution!
Could you remove the change in the uv.lock file? Then I'll merge the PR.
I'll work on updating the macro to use newer pyo3 when possible.
jurmy24
force-pushed
the
fix/pyo3-dependencies
branch
from
May 26, 2026 15:01
a5d0ee6 to
2350145
Compare
Contributor
Author
|
Done! |
pierre-rouanet
self-requested a review
May 26, 2026 15:31
pierre-rouanet
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pin pyo3 and pyo3-stub-gen to the last versions compatible with the current macro-generated Python bindings so the python feature builds again.
Problem
Building with the python feature (e.g. cargo run --bin stub_gen --features python or maturin develop --features python --features pyo3/extension-module) failed with a bunch of errors like:
error[E0034]: multiple applicable items in scope --> src/servo/servo_macro.rs:NNN:22 | NNN | ) -> PyResult<PyObject> { | ^^^^^^^^ multiplewrapfound | = note: candidate #1: IntoPyObjectConverter<T> = note: candidate #2: IntoPyObjectConverter<Result<T, E>>The error came from every macro-expanded controller because generate_servo! produces methods returning PyResult, and newer pyo3 / pyo3-stub-gen don't resolve the conversion properly.
Cause: the open ranges in Cargo.toml
pyo3 = { version = ">=0.27.1", ... }
pyo3-stub-gen = { version = ">=0.17.0", ... }
resolved to pyo3 0.28.3 and pyo3-stub-gen 0.22.3, which broke the existing macro layer.
Fix
Pin to the last compatible versions:
pyo3 = { version = "=0.27.1", ... }
pyo3-stub-gen = { version = "=0.21.0", ... }
After this, cargo run --bin stub_gen --features python and maturin develop build cleanly. Default cargo check / cargo test are unaffected.
Notes
Some deprecation warnings about pyo3::PyObject -> Py remain in the macro layer. They are non-blocking.