diff --git a/Cargo.toml b/Cargo.toml index b634e8720..650dc0eac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,12 +22,16 @@ num-complex = ">= 0.2, < 0.5" num-integer = "0.1" num-traits = "0.2" ndarray = ">= 0.15, < 0.17" -pyo3 = { version = "0.21.0", default-features = false, features = ["macros"] } +pyo3 = { version = "0.22.0", default-features = false, features = ["macros"] } rustc-hash = "1.1" [dev-dependencies] -pyo3 = { version = "0.21.0", default-features = false, features = ["auto-initialize"] } +pyo3 = { version = "0.22.0", default-features = false, features = ["auto-initialize"] } nalgebra = { version = "0.32", default-features = false, features = ["std"] } [package.metadata.docs.rs] all-features = true + +[features] +default = ["gil-refs"] +"gil-refs" = ["pyo3/gil-refs"] diff --git a/src/datetime.rs b/src/datetime.rs index 794170616..b5a4c0758 100644 --- a/src/datetime.rs +++ b/src/datetime.rs @@ -243,7 +243,7 @@ impl TypeDescriptors { } }; - dtype.clone().into_bound(py) + dtype.bind(py).to_owned() } } diff --git a/src/dtype.rs b/src/dtype.rs index bc68dbaa8..5e7b0118f 100644 --- a/src/dtype.rs +++ b/src/dtype.rs @@ -825,6 +825,7 @@ mod tests { use super::*; use pyo3::{py_run, types::PyTypeMethods}; + use pyo3::types::PyString; use crate::npyffi::{is_numpy_2, NPY_NEEDS_PYAPI}; @@ -851,7 +852,7 @@ mod tests { #[test] fn test_dtype_names() { - fn type_name<'py, T: Element>(py: Python<'py>) -> String { + fn type_name(py: Python) -> Bound { dtype_bound::(py).typeobj().qualname().unwrap() } Python::with_gil(|py| { diff --git a/src/strings.rs b/src/strings.rs index 1f440fbda..5e96da17f 100644 --- a/src/strings.rs +++ b/src/strings.rs @@ -191,7 +191,7 @@ impl TypeDescriptors { } }; - dtype.clone().into_bound(py) + dtype.bind(py).to_owned() } }