-
Notifications
You must be signed in to change notification settings - Fork 951
Description
Two points (Using pyo3 master branch from today, Rust 1.43.0 nightly from 2020-02-22), both should be noted in the release notes.
first
After #770, I've noticed that I can't use &Class and &mut Class as method arguments anymore, where Class is a #[pyclass] annotated struct. Instead, it has to be &PyCell<Class> (I assume, at least that works).
second
Furthermore, now I can't cast PyAny and PyObject objects referring to a Class to Rust references anymore. Previously I used PyAny::downcast_ref (now downcast) and PyObject::cast_as. The error is in both cases the same, i.e.
error[E0277]: the trait bound `ast::segments::OtherSegment: pyo3::instance::PyNativeType` is not satisfied
--> src/ast/mod.rs:405:37
|
405 | } else if let Ok(seg) = seg.cast_as::<OtherSegment>(py) {
| ^^^^^^^ the trait `pyo3::instance::PyNativeType` is not implemented for `ast::segments::OtherSegment`
|
= note: required because of the requirements on the impl of `pyo3::conversion::PyTryFrom<'_>` for `ast::segments::OtherSegment`
One way I found to fix this was to use seg.extract::<&PyCell<OtherSegment>>.borrow().
This is quite cumbersome -- is there/could there be a shortcut?
Of course this should also be noted in the release notes.
Thanks!