-
Notifications
You must be signed in to change notification settings - Fork 901
Description
Bug Description
The plugin example as of 3cfa04fa9179647fb78e54a32e9488617f6fbbe9 does not compile.
Steps to Reproduce
cd examples/plugincargo run
Backtrace
Compiling plugin_example v0.1.0 (C:\Users\\Documents\GitHub\pyo3\examples\plugin)
error[E0277]: the trait bound `&PyList: FromPyObjectBound<'_, '_>` is not satisfied
--> src/main.rs:16:67
|
16 | let syspath: &PyList = py.import("sys")?.getattr("path")?.extract()?;
| ^^^^^^^ the trait `PyClass` is not implemented for `&PyList`, which is required by `&PyList: FromPyObjectBound<'_, '_>`
|
= help: the following other types implement trait `FromPyObjectBound<'a, 'py>`:
&'a [u8]
&'a str
Cow<'a, [u8]>
Cow<'a, str>
= note: required for `&PyList` to implement `FromPyObject<'_>`
= note: required for `&PyList` to implement `FromPyObjectBound<'_, '_>`
note: required by a bound in `pyo3::types::PyAnyMethods::extract`
--> C:\Users\\Documents\GitHub\pyo3\src\types\any.rs:815:12
|
813 | fn extract<'a, T>(&'a self) -> PyResult<T>
| ------- required by a bound in this associated function
814 | where
815 | T: FromPyObjectBound<'a, 'py>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `PyAnyMethods::extract`
error[E0599]: no method named `insert` found for reference `&PyList` in the current scope
--> src/main.rs:17:17
|
17 | syspath.insert(0, &path)?;
| ^^^^^^ method not found in `&PyList`
error[E0277]: `PyList` doesn't implement `Debug`
--> src/main.rs:18:42
|
18 | println!("Import path is: {:?}", syspath);
| ^^^^^^^ `PyList` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= help: the trait `Debug` is not implemented for `PyList`, which is required by `&PyList: Debug`
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `plugin_example` (bin "plugin_example") due to 3 previous errors
### Your operating system and version
Windows 11
### Your Python version (`python --version`)
Python 3.12.5
### Your Rust version (`rustc --version`)
rustc 1.80.1 (3f5fd8dd4 2024-08-06)
### Your PyO3 version
0.22.2
### How did you install python? Did you use a virtualenv?
python.org. no virtualenv
### Additional Info
_No response_
Metadata
Metadata
Assignees
Labels
No labels