Skip to content

Commit d252e9c

Browse files
committed
chore: Bump pyo3 to 0.27
1 parent 6397a9a commit d252e9c

File tree

5 files changed

+39
-33
lines changed

5 files changed

+39
-33
lines changed

python/Cargo.lock

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ async-tiff = { path = "../" }
2525
bytes = "1.10.1"
2626
futures = "0.3.31"
2727
object_store = "0.12"
28-
pyo3 = { version = "0.26.0", features = ["macros"] }
29-
pyo3-async-runtimes = "0.26"
30-
pyo3-bytes = "0.4"
31-
pyo3-object_store = "0.6.0"
28+
pyo3 = { version = "0.27.0", features = ["macros"] }
29+
pyo3-async-runtimes = "0.27"
30+
pyo3-bytes = "0.5"
31+
pyo3-object_store = "0.7.0"
3232
rayon = "1.11.0"
3333
tokio-rayon = "2.1.0"
3434
thiserror = "1"

python/src/decoder.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,16 @@ impl PyDecoder {
6060
}
6161
}
6262

63-
impl<'py> FromPyObject<'py> for PyDecoder {
64-
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
65-
if !ob.hasattr(intern!(ob.py(), "__call__"))? {
63+
impl<'py> FromPyObject<'_, 'py> for PyDecoder {
64+
type Error = PyErr;
65+
66+
fn extract(obj: Borrowed<'_, 'py, PyAny>) -> Result<Self, Self::Error> {
67+
if !obj.hasattr(intern!(obj.py(), "__call__"))? {
6668
return Err(PyTypeError::new_err(
6769
"Expected callable object for custom decoder.",
6870
));
6971
}
70-
Ok(Self(ob.clone().unbind()))
72+
Ok(Self(obj.as_unbound().clone_ref(obj.py())))
7173
}
7274
}
7375

python/src/enums.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ impl From<PyCompressionMethod> for CompressionMethod {
2121
}
2222
}
2323

24-
impl<'py> FromPyObject<'py> for PyCompressionMethod {
25-
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
26-
Ok(Self(CompressionMethod::from_u16_exhaustive(ob.extract()?)))
24+
impl<'py> FromPyObject<'_, 'py> for PyCompressionMethod {
25+
type Error = PyErr;
26+
27+
fn extract(obj: Borrowed<'_, 'py, PyAny>) -> Result<Self, Self::Error> {
28+
Ok(Self(CompressionMethod::from_u16_exhaustive(obj.extract()?)))
2729
}
2830
}
2931

python/src/reader.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,15 @@ impl ObspecBackend {
9595
}
9696
}
9797

98-
impl<'py> FromPyObject<'py> for ObspecBackend {
99-
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
100-
let py = ob.py();
101-
if ob.hasattr(intern!(py, "get_range_async"))?
102-
&& ob.hasattr(intern!(py, "get_ranges_async"))?
98+
impl<'py> FromPyObject<'_, 'py> for ObspecBackend {
99+
type Error = PyErr;
100+
101+
fn extract(obj: Borrowed<'_, 'py, PyAny>) -> Result<Self, Self::Error> {
102+
let py = obj.py();
103+
if obj.hasattr(intern!(py, "get_range_async"))?
104+
&& obj.hasattr(intern!(py, "get_ranges_async"))?
103105
{
104-
Ok(Self(ob.clone().unbind()))
106+
Ok(Self(obj.as_unbound().clone_ref(py)))
105107
} else {
106108
Err(PyTypeError::new_err("Expected obspec-compatible class with `get_range_async` and `get_ranges_async` method."))
107109
}

0 commit comments

Comments
 (0)