Skip to content

Commit 6753396

Browse files
clin1234indygreg
authored andcommitted
rust: update PyO3 to 0.25.x
Closes #273. Closes #251.
1 parent ba68dbd commit 6753396

File tree

10 files changed

+33
-33
lines changed

10 files changed

+33
-33
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ version = "2.0.10+zstd.1.5.6"
2626
features = ["experimental", "legacy", "zstdmt"]
2727

2828
[dependencies.pyo3]
29-
version = "0.24.2"
29+
version = "0.25.1"
3030
features = ["extension-module"]

docs/news.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Version History
77
0.25.0 (not yet released)
88
=========================
99

10-
Nothing yet.
10+
* PyO3 Rust created upgraded from 0.24 to 0.25. (#273)
1111

1212
0.24.0 (released 2025-08-17)
1313
============================

rust-ext/src/buffers.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use {
1212
ffi::Py_buffer,
1313
prelude::*,
1414
types::{PyBytes, PyTuple},
15+
IntoPyObjectExt,
1516
},
1617
};
1718

@@ -242,7 +243,7 @@ impl ZstdBufferWithSegments {
242243
}
243244

244245
Ok(Self {
245-
source: data.into_py(py),
246+
source: data.into_py_any(py)?,
246247
buffer: data_buffer,
247248
segments,
248249
})
@@ -344,7 +345,7 @@ impl ZstdBufferWithSegmentsCollection {
344345

345346
offset += segment.segments.len();
346347

347-
buffers.push(item.to_object(py));
348+
buffers.push(item.into_py_any(py)?);
348349
first_elements.push(offset);
349350
}
350351

rust-ext/src/compression_chunker.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use {
1010
stream::{make_in_buffer_source, InBufferSource},
1111
zstd_safe::CCtx,
1212
},
13-
pyo3::{prelude::*, types::PyBytes},
13+
pyo3::{prelude::*, types::PyBytes, IntoPyObjectExt},
1414
std::sync::Arc,
1515
};
1616

@@ -118,8 +118,7 @@ impl ZstdCompressionChunker {
118118
));
119119
}
120120

121-
let source =
122-
make_in_buffer_source(py, &PyBytes::new(py, &[]), zstd_safe::CCtx::in_size())?;
121+
let source = make_in_buffer_source(py, &PyBytes::new(py, &[]), zstd_safe::CCtx::in_size())?;
123122

124123
let it = Bound::new(
125124
py,
@@ -152,8 +151,7 @@ impl ZstdCompressionChunker {
152151
));
153152
}
154153

155-
let source =
156-
make_in_buffer_source(py, &PyBytes::new(py, &[]), zstd_safe::CCtx::in_size())?;
154+
let source = make_in_buffer_source(py, &PyBytes::new(py, &[]), zstd_safe::CCtx::in_size())?;
157155

158156
let it = Bound::new(
159157
py,
@@ -225,7 +223,7 @@ impl ZstdCompressionChunkerIterator {
225223
let chunk = PyBytes::new(py, &slf.dest_buffer);
226224
slf.dest_buffer.clear();
227225

228-
return Ok(Some(chunk.into_py(py)));
226+
return Ok(Some(chunk.into_py_any(py)?));
229227
}
230228

231229
// Else continue to compress available input data.
@@ -278,6 +276,6 @@ impl ZstdCompressionChunkerIterator {
278276
let chunk = PyBytes::new(py, &slf.dest_buffer);
279277
slf.dest_buffer.clear();
280278

281-
Ok(Some(chunk.into_py(py)))
279+
Ok(Some(chunk.into_py_any(py)?))
282280
}
283281
}

rust-ext/src/compression_writer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use {
1111
exceptions::{PyNotImplementedError, PyOSError, PyValueError},
1212
prelude::*,
1313
types::PyBytes,
14+
IntoPyObjectExt,
1415
},
1516
std::sync::Arc,
1617
};
@@ -48,7 +49,7 @@ impl ZstdCompressionWriter {
4849

4950
Ok(Self {
5051
cctx,
51-
writer: writer.into_py(py),
52+
writer: writer.into_py_any(py)?,
5253
write_return_read,
5354
closefd,
5455
entered: false,

rust-ext/src/compressor_iterator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use {
1010
stream::{make_in_buffer_source, InBufferSource},
1111
zstd_safe::CCtx,
1212
},
13-
pyo3::{prelude::*, types::PyBytes},
13+
pyo3::{prelude::*, types::PyBytes, IntoPyObjectExt},
1414
std::sync::Arc,
1515
};
1616

@@ -60,7 +60,7 @@ impl ZstdCompressorIterator {
6060
// TODO avoid buffer copy
6161
let chunk = PyBytes::new(py, &dest_buffer);
6262

63-
return Ok(Some(chunk.into_py(py)));
63+
return Ok(Some(chunk.into_py_any(py)?));
6464
}
6565

6666
// Else read another chunk in hopes of producing output data.
@@ -94,7 +94,7 @@ impl ZstdCompressorIterator {
9494
// TODO avoid buffer copy.
9595
let chunk = PyBytes::new(py, &dest_buffer);
9696

97-
return Ok(Some(chunk.into_py(py)));
97+
return Ok(Some(chunk.into_py_any(py)?));
9898
}
9999

100100
Ok(None)

rust-ext/src/decompression_writer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use {
1111
exceptions::{PyOSError, PyValueError},
1212
prelude::*,
1313
types::PyBytes,
14+
IntoPyObjectExt,
1415
},
1516
std::sync::Arc,
1617
};
@@ -40,7 +41,7 @@ impl ZstdDecompressionWriter {
4041
) -> PyResult<Self> {
4142
Ok(Self {
4243
dctx,
43-
writer: writer.into_py(py),
44+
writer: writer.into_py_any(py)?,
4445
write_size,
4546
write_return_read,
4647
closefd,

rust-ext/src/decompressor_iterator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use {
1010
stream::{make_in_buffer_source, InBufferSource},
1111
zstd_safe::DCtx,
1212
},
13-
pyo3::{exceptions::PyValueError, prelude::*, types::PyBytes},
13+
pyo3::{exceptions::PyValueError, prelude::*, types::PyBytes, IntoPyObjectExt},
1414
std::{cmp::min, sync::Arc},
1515
};
1616

@@ -60,7 +60,7 @@ impl ZstdDecompressorIterator {
6060
if !dest_buffer.is_empty() {
6161
// TODO avoid buffer copy.
6262
let chunk = PyBytes::new(py, &dest_buffer);
63-
return Ok(Some(chunk.into_py(py)));
63+
return Ok(Some(chunk.into_py_any(py)?));
6464
}
6565

6666
// Repeat loop to collect more input data.
@@ -71,7 +71,7 @@ impl ZstdDecompressorIterator {
7171
if !dest_buffer.is_empty() {
7272
// TODO avoid buffer copy.
7373
let chunk = PyBytes::new(py, &dest_buffer);
74-
Ok(Some(chunk.into_py(py)))
74+
Ok(Some(chunk.into_py_any(py)?))
7575
} else {
7676
Ok(None)
7777
}

rust-ext/src/stream.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// of the BSD license. See the LICENSE file for details.
66

77
use {
8-
pyo3::{buffer::PyBuffer, exceptions::PyValueError, prelude::*},
8+
pyo3::{buffer::PyBuffer, exceptions::PyValueError, prelude::*, IntoPyObjectExt},
99
zstd_sys::ZSTD_inBuffer,
1010
};
1111

@@ -139,7 +139,7 @@ pub(crate) fn make_in_buffer_source(
139139
) -> PyResult<Box<dyn InBufferSource + Send>> {
140140
if source.hasattr("read")? {
141141
Ok(Box::new(ReadSource {
142-
source: source.into_py(py),
142+
source: source.into_py_any(py)?,
143143
buffer: None,
144144
read_size,
145145
finished: false,
@@ -153,7 +153,7 @@ pub(crate) fn make_in_buffer_source(
153153
})?;
154154

155155
Ok(Box::new(BufferSource {
156-
source: source.into_py(py),
156+
source: source.into_py_any(py)?,
157157
buffer,
158158
offset: 0,
159159
}))

0 commit comments

Comments
 (0)