diff --git a/Cargo.lock b/Cargo.lock index 73ce919d..15fa1e5c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -250,11 +250,10 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.24.2" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5203598f366b11a02b13aa20cab591229ff0a89fd121a308a5df751d5fc9219" +checksum = "8970a78afe0628a3e3430376fc5fd76b6b45c4d43360ffd6cdd40bdde72b682a" dependencies = [ - "cfg-if", "indoc", "libc", "memoffset", @@ -268,9 +267,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.24.2" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99636d423fa2ca130fa5acde3059308006d46f98caac629418e53f7ebb1e9999" +checksum = "458eb0c55e7ece017adeba38f2248ff3ac615e53660d7c71a238d7d2a01c7598" dependencies = [ "once_cell", "target-lexicon", @@ -278,9 +277,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.24.2" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78f9cf92ba9c409279bc3305b5409d90db2d2c22392d443a87df3a1adad59e33" +checksum = "7114fe5457c61b276ab77c5055f206295b812608083644a5c5b2640c3102565c" dependencies = [ "libc", "pyo3-build-config", @@ -288,9 +287,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.24.2" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b999cb1a6ce21f9a6b147dcf1be9ffedf02e0043aec74dc390f3007047cecd9" +checksum = "a8725c0a622b374d6cb051d11a0983786448f7785336139c3c94f5aa6bef7e50" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -300,9 +299,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.24.2" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "822ece1c7e1012745607d5cf0bcb2874769f0f7cb34c4cde03b9358eb9ef911a" +checksum = "4109984c22491085343c05b0dbc54ddc405c3cf7b4374fc533f5c3313a572ccc" dependencies = [ "heck", "proc-macro2", @@ -313,7 +312,7 @@ dependencies = [ [[package]] name = "python-zstandard" -version = "0.24.0-pre" +version = "0.25.0-pre" dependencies = [ "libc", "num_cpus", diff --git a/Cargo.toml b/Cargo.toml index ccf3237d..a8f8e0eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,5 +26,5 @@ version = "2.0.10+zstd.1.5.6" features = ["experimental", "legacy", "zstdmt"] [dependencies.pyo3] -version = "0.24.2" +version = "0.25.1" features = ["extension-module"] diff --git a/rust-ext/src/buffers.rs b/rust-ext/src/buffers.rs index b48b7660..c38d0f9f 100644 --- a/rust-ext/src/buffers.rs +++ b/rust-ext/src/buffers.rs @@ -11,7 +11,7 @@ use { exceptions::{PyIndexError, PyTypeError, PyValueError}, ffi::Py_buffer, prelude::*, - types::{PyBytes, PyTuple}, + types::{PyBytes, PyTuple}, IntoPyObjectExt, }, }; @@ -242,7 +242,7 @@ impl ZstdBufferWithSegments { } Ok(Self { - source: data.into_py(py), + source: data.into_py_any(py)?, buffer: data_buffer, segments, }) @@ -344,7 +344,7 @@ impl ZstdBufferWithSegmentsCollection { offset += segment.segments.len(); - buffers.push(item.to_object(py)); + buffers.push(item.into_py_any(py)?); first_elements.push(offset); } diff --git a/rust-ext/src/compression_chunker.rs b/rust-ext/src/compression_chunker.rs index c3828302..692c31a6 100644 --- a/rust-ext/src/compression_chunker.rs +++ b/rust-ext/src/compression_chunker.rs @@ -10,7 +10,7 @@ use { stream::{make_in_buffer_source, InBufferSource}, zstd_safe::CCtx, }, - pyo3::{prelude::*, types::PyBytes}, + pyo3::{prelude::*, types::PyBytes, IntoPyObjectExt}, std::sync::Arc, }; @@ -225,7 +225,7 @@ impl ZstdCompressionChunkerIterator { let chunk = PyBytes::new(py, &slf.dest_buffer); slf.dest_buffer.clear(); - return Ok(Some(chunk.into_py(py))); + return Ok(Some(chunk.into_py_any(py)?)); } // Else continue to compress available input data. @@ -278,6 +278,6 @@ impl ZstdCompressionChunkerIterator { let chunk = PyBytes::new(py, &slf.dest_buffer); slf.dest_buffer.clear(); - Ok(Some(chunk.into_py(py))) + Ok(Some(chunk.into_py_any(py)?)) } } diff --git a/rust-ext/src/compression_writer.rs b/rust-ext/src/compression_writer.rs index 570c24ea..88d72307 100644 --- a/rust-ext/src/compression_writer.rs +++ b/rust-ext/src/compression_writer.rs @@ -10,7 +10,7 @@ use { buffer::PyBuffer, exceptions::{PyNotImplementedError, PyOSError, PyValueError}, prelude::*, - types::PyBytes, + types::PyBytes, IntoPyObjectExt, }, std::sync::Arc, }; @@ -48,7 +48,7 @@ impl ZstdCompressionWriter { Ok(Self { cctx, - writer: writer.into_py(py), + writer: writer.into_py_any(py)?, write_return_read, closefd, entered: false, diff --git a/rust-ext/src/compressor_iterator.rs b/rust-ext/src/compressor_iterator.rs index 7810594a..86bf25d2 100644 --- a/rust-ext/src/compressor_iterator.rs +++ b/rust-ext/src/compressor_iterator.rs @@ -10,7 +10,7 @@ use { stream::{make_in_buffer_source, InBufferSource}, zstd_safe::CCtx, }, - pyo3::{prelude::*, types::PyBytes}, + pyo3::{prelude::*, types::PyBytes, IntoPyObjectExt}, std::sync::Arc, }; @@ -60,7 +60,7 @@ impl ZstdCompressorIterator { // TODO avoid buffer copy let chunk = PyBytes::new(py, &dest_buffer); - return Ok(Some(chunk.into_py(py))); + return Ok(Some(chunk.into_py_any(py)?)); } // Else read another chunk in hopes of producing output data. @@ -94,7 +94,7 @@ impl ZstdCompressorIterator { // TODO avoid buffer copy. let chunk = PyBytes::new(py, &dest_buffer); - return Ok(Some(chunk.into_py(py))); + return Ok(Some(chunk.into_py_any(py)?)); } Ok(None) diff --git a/rust-ext/src/decompression_writer.rs b/rust-ext/src/decompression_writer.rs index b6321acc..0dce2a8e 100644 --- a/rust-ext/src/decompression_writer.rs +++ b/rust-ext/src/decompression_writer.rs @@ -10,7 +10,7 @@ use { buffer::PyBuffer, exceptions::{PyOSError, PyValueError}, prelude::*, - types::PyBytes, + types::PyBytes, IntoPyObjectExt, }, std::sync::Arc, }; @@ -40,7 +40,7 @@ impl ZstdDecompressionWriter { ) -> PyResult { Ok(Self { dctx, - writer: writer.into_py(py), + writer: writer.into_py_any(py)?, write_size, write_return_read, closefd, diff --git a/rust-ext/src/decompressor_iterator.rs b/rust-ext/src/decompressor_iterator.rs index ce7d9a8f..ac6f255c 100644 --- a/rust-ext/src/decompressor_iterator.rs +++ b/rust-ext/src/decompressor_iterator.rs @@ -10,7 +10,7 @@ use { stream::{make_in_buffer_source, InBufferSource}, zstd_safe::DCtx, }, - pyo3::{exceptions::PyValueError, prelude::*, types::PyBytes}, + pyo3::{exceptions::PyValueError, prelude::*, types::PyBytes, IntoPyObjectExt}, std::{cmp::min, sync::Arc}, }; @@ -60,7 +60,7 @@ impl ZstdDecompressorIterator { if !dest_buffer.is_empty() { // TODO avoid buffer copy. let chunk = PyBytes::new(py, &dest_buffer); - return Ok(Some(chunk.into_py(py))); + return Ok(Some(chunk.into_py_any(py)?)); } // Repeat loop to collect more input data. @@ -71,7 +71,7 @@ impl ZstdDecompressorIterator { if !dest_buffer.is_empty() { // TODO avoid buffer copy. let chunk = PyBytes::new(py, &dest_buffer); - Ok(Some(chunk.into_py(py))) + Ok(Some(chunk.into_py_any(py)?)) } else { Ok(None) } diff --git a/rust-ext/src/stream.rs b/rust-ext/src/stream.rs index 89b35e98..72dbbe4e 100644 --- a/rust-ext/src/stream.rs +++ b/rust-ext/src/stream.rs @@ -5,7 +5,7 @@ // of the BSD license. See the LICENSE file for details. use { - pyo3::{buffer::PyBuffer, exceptions::PyValueError, prelude::*}, + pyo3::{buffer::PyBuffer, exceptions::PyValueError, prelude::*, IntoPyObjectExt}, zstd_sys::ZSTD_inBuffer, }; @@ -139,7 +139,7 @@ pub(crate) fn make_in_buffer_source( ) -> PyResult> { if source.hasattr("read")? { Ok(Box::new(ReadSource { - source: source.into_py(py), + source: source.into_py_any(py)?, buffer: None, read_size, finished: false, @@ -153,7 +153,7 @@ pub(crate) fn make_in_buffer_source( })?; Ok(Box::new(BufferSource { - source: source.into_py(py), + source: source.into_py_any(py)?, buffer, offset: 0, }))