|
10 | 10 | stream::{make_in_buffer_source, InBufferSource}, |
11 | 11 | zstd_safe::CCtx, |
12 | 12 | }, |
13 | | - pyo3::{prelude::*, types::PyBytes}, |
| 13 | + pyo3::{prelude::*, types::PyBytes, IntoPyObjectExt}, |
14 | 14 | std::sync::Arc, |
15 | 15 | }; |
16 | 16 |
|
@@ -118,8 +118,7 @@ impl ZstdCompressionChunker { |
118 | 118 | )); |
119 | 119 | } |
120 | 120 |
|
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())?; |
123 | 122 |
|
124 | 123 | let it = Bound::new( |
125 | 124 | py, |
@@ -152,8 +151,7 @@ impl ZstdCompressionChunker { |
152 | 151 | )); |
153 | 152 | } |
154 | 153 |
|
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())?; |
157 | 155 |
|
158 | 156 | let it = Bound::new( |
159 | 157 | py, |
@@ -225,7 +223,7 @@ impl ZstdCompressionChunkerIterator { |
225 | 223 | let chunk = PyBytes::new(py, &slf.dest_buffer); |
226 | 224 | slf.dest_buffer.clear(); |
227 | 225 |
|
228 | | - return Ok(Some(chunk.into_py(py))); |
| 226 | + return Ok(Some(chunk.into_py_any(py)?)); |
229 | 227 | } |
230 | 228 |
|
231 | 229 | // Else continue to compress available input data. |
@@ -278,6 +276,6 @@ impl ZstdCompressionChunkerIterator { |
278 | 276 | let chunk = PyBytes::new(py, &slf.dest_buffer); |
279 | 277 | slf.dest_buffer.clear(); |
280 | 278 |
|
281 | | - Ok(Some(chunk.into_py(py))) |
| 279 | + Ok(Some(chunk.into_py_any(py)?)) |
282 | 280 | } |
283 | 281 | } |
0 commit comments