Skip to content

please update pyo3 dependency to 0.25 #913

@WeepingClown13

Description

@WeepingClown13

Hi, I am updating pendulum on debian side and now that we have pyo3 0.25 in debian, it needs to be compatible with that. After some time of juggling with the documentation and repeated testing, I got to get it compatible. But I am not sure how elegant or proper of a solution it is, so I am not proposing an MR yet. It just make everything works fine, all tests pass, the package bulds, and all that. Could you share your thoughts? One option is that you can take the patch and work on any improvements later.

-- a/rust/src/python/parsing.rs
+++ b/rust/src/python/parsing.rs
@@ -6,2 +6,3 @@
 use pyo3::types::PyTime;
+use pyo3::conversion::IntoPyObjectExt;
 
@@ -33,4 +34,3 @@
                                 Py::new(py, FixedTimezone::new(offset, datetime.tzname))?
-                                    .to_object(py)
-                                    .downcast_bound(py)?,
+                                    .into_pyobject(py).unwrap().downcast().unwrap()
                             ),
@@ -38,3 +38,3 @@
 
-                        Ok(dt.to_object(py))
+                        Ok(dt.into_py_any(py).unwrap())
                     }
@@ -53,3 +53,3 @@
 
-                        Ok(dt.to_object(py))
+                        Ok(dt.into_py_any(py).unwrap())
                     }
@@ -64,3 +64,3 @@
 
-                    Ok(dt.to_object(py))
+                    Ok(dt.into_py_any(py).unwrap())
                 }
@@ -76,4 +76,3 @@
                                 Py::new(py, FixedTimezone::new(offset, datetime.tzname))?
-                                    .to_object(py)
-                                    .downcast_bound(py)?,
+                                    .into_pyobject(py).unwrap().downcast().unwrap(),
                             ),
@@ -81,3 +80,3 @@
 
-                        Ok(dt.to_object(py))
+                        Ok(dt.into_py_any(py).unwrap())
                     }
@@ -93,3 +92,3 @@
 
-                        Ok(dt.to_object(py))
+                        Ok(dt.into_py_any(py).unwrap())
                     }
@@ -113,3 +112,3 @@
             )?
-            .to_object(py)),
+            .into_py_any(py).unwrap()),
             (_, _, _) => Err(exceptions::PyValueError::new_err(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions