-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Description
Multiple test failures are observed due to API changes in .
The issues are reproducible on x86_64, indicating they are not architecture-specific.
Issues
1. Type Mismatch (Breaking Change)
expected Result<&PyAny, PyErr>
found Result<Bound<'_, PyAny>, PyErr>
Caused by transition from &PyAny → Bound<'py, PyAny>
2. Deprecated API Usage
.downcast() → deprecated (use Bound::cast / downcast_bound)
Python::with_gil → deprecated (use Python::attach)
3. Method Resolution Failures
no method named call1 for &PyAny
no method named is_instance_of
no method named set_item for &PyDict
Indicates incompatibility with newer PyO3 types
4. Downcasting Errors
no method named downcast for Py<T>
Suggested replacement: downcast_bound
5. Ownership & Borrowing Issues
Temporary value dropped while borrowed (E0716)
use of moved value (E0382)
Due to the new ownership model with Bound<'py, T>
6. Argument / Signature Mismatches
expected &PyDict, found Bound<'_, PyDict>
Function signatures incompatible with updated API
Root Cause:
These issues stem from PyO3’s migration to a safer API using Bound<'py, T> instead of borrowed references (&PyAny, &PyDict), along with related method and lifetime handling changes.
Proposed Solution:
We think that with the above failures, these changes may get it working:
- Replace &PyAny with Bound<'_, PyAny> in function signatures.
- Replace &PyDict with Bound<'_, PyDict> in function signatures.
- Change .downcast() to .downcast_bound() when calling on a Py.
- Pass &bound_object (by reference) to methods like contains or append.
- Break up long method chains (like getattr(...).downcast(...)) into two steps using a let binding.