Skip to content

Commit

Permalink
update FromPyObject for T: PyClass + Clone impl
Browse files Browse the repository at this point in the history
  • Loading branch information
Icxolu committed Mar 1, 2024
1 parent f86c082 commit d58c309
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,9 @@ impl<T> FromPyObject<'_> for T
where
T: PyClass + Clone,
{
fn extract(obj: &PyAny) -> PyResult<Self> {
#[allow(deprecated)]
let cell: &PyCell<Self> = obj.downcast()?;
Ok(unsafe { cell.try_borrow_unguarded()?.clone() })
fn extract_bound(obj: &Bound<'_, PyAny>) -> PyResult<Self> {
let bound = obj.downcast::<Self>()?;
Ok(bound.try_borrow()?.clone())
}
}

Expand Down

0 comments on commit d58c309

Please sign in to comment.