public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-cramjam] epel10: Update to PyO3 0.29
@ 2026-06-29 14:46 Benjamin A. Beasley
0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-06-29 14:46 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-cramjam
Branch : epel10
Commit : 73c625e4918d37b52e105d724591ca3a2b614a98
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date : 2026-06-29T15:42:27+01:00
Stats : +373/-369 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/python-cramjam/c/73c625e4918d37b52e105d724591ca3a2b614a98?branch=epel10
Log:
Update to PyO3 0.29
---
diff --git a/cramjam-2.11.0-pyo3-0.28.patch b/cramjam-2.11.0-pyo3-0.28.patch
deleted file mode 100644
index 8b7d15e..0000000
--- a/cramjam-2.11.0-pyo3-0.28.patch
+++ /dev/null
@@ -1,368 +0,0 @@
-diff -Naur cramjam-2.11.0-original/Cargo.toml cramjam-2.11.0/Cargo.toml
---- cramjam-2.11.0-original/Cargo.toml 1970-01-01 01:00:00.000000000 +0100
-+++ cramjam-2.11.0/Cargo.toml 2026-06-19 21:25:39.298774732 +0100
-@@ -71,11 +71,11 @@
-
-
- [dependencies]
--pyo3 = { version = "^0.25", default-features = false, features = ["macros"] }
-+pyo3 = { version = "^0.28", default-features = false, features = ["macros"] }
- libcramjam = { version = "^0.8", default-features = false }
-
- [build-dependencies]
--pyo3-build-config = "^0.25"
-+pyo3-build-config = "^0.28"
-
- [profile.release]
- strip = true
-diff -Naur cramjam-2.11.0-original/pyproject.toml cramjam-2.11.0/pyproject.toml
---- cramjam-2.11.0-original/pyproject.toml 2025-07-27 21:42:07.000000000 +0100
-+++ cramjam-2.11.0/pyproject.toml 2026-06-19 21:25:56.572961647 +0100
-@@ -2,7 +2,7 @@
- name = "cramjam"
- version = "2.11.0"
- keywords = ["compression", "decompression", "snappy", "zstd", "bz2", "gzip", "lz4", "brotli", "deflate", "blosc2"]
--requires-python = ">=3.8"
-+requires-python = ">=3.11"
- license = { file = "LICENSE" }
-
- [project.urls]
-diff -Naur cramjam-2.11.0-original/src/blosc2.rs cramjam-2.11.0/src/blosc2.rs
---- cramjam-2.11.0-original/src/blosc2.rs 2025-07-27 21:42:07.000000000 +0100
-+++ cramjam-2.11.0/src/blosc2.rs 2026-06-19 21:25:39.298994605 +0100
-@@ -143,7 +143,7 @@
- pub fn decompress_chunk(py: Python, data: BytesType, output_len: Option<usize>) -> PyResult<RustyBuffer> {
- let bytes = data.as_bytes();
- let buf = py
-- .allow_threads(|| libcramjam::blosc2::decompress_chunk(bytes))
-+ .detach(|| libcramjam::blosc2::decompress_chunk(bytes))
- .map(RustyBuffer::from)?;
- Ok(buf)
- }
-@@ -153,7 +153,7 @@
- pub fn decompress_chunk_into(py: Python, input: BytesType, mut output: BytesType) -> PyResult<usize> {
- let bytes = input.as_bytes();
- let out = output.as_bytes_mut()?;
-- let nbytes = py.allow_threads(|| libcramjam::blosc2::decompress_chunk_into(bytes, out))?;
-+ let nbytes = py.detach(|| libcramjam::blosc2::decompress_chunk_into(bytes, out))?;
- Ok(nbytes)
- }
-
-@@ -176,7 +176,7 @@
- codec: Option<PyCodec>,
- ) -> PyResult<RustyBuffer> {
- let bytes = data.as_bytes();
-- py.allow_threads(|| {
-+ py.detach(|| {
- let clevel = clevel.map(Into::into);
- let filter = filter.map(Into::into);
- let codec = codec.map(Into::into);
-@@ -200,7 +200,7 @@
- ) -> PyResult<usize> {
- let bytes = input.as_bytes();
- let out = output.as_bytes_mut()?;
-- py.allow_threads(|| {
-+ py.detach(|| {
- let clevel = clevel.map(Into::into);
- let filter = filter.map(Into::into);
- let codec = codec.map(Into::into);
-diff -Naur cramjam-2.11.0-original/src/io.rs cramjam-2.11.0/src/io.rs
---- cramjam-2.11.0-original/src/io.rs 2025-07-27 21:42:07.000000000 +0100
-+++ cramjam-2.11.0/src/io.rs 2026-06-19 21:25:39.299162587 +0100
-@@ -14,7 +14,6 @@
- use pyo3::ffi;
- use pyo3::prelude::*;
- use pyo3::types::PyBytes;
--use pyo3::IntoPyObjectExt;
- use std::path::PathBuf;
-
- pub(crate) trait AsBytes {
-@@ -210,7 +209,7 @@
- pub fn as_slice_mut(&mut self) -> PyResult<&mut [u8]> {
- #[cfg(any(PyPy, Py_GIL_DISABLED))]
- {
-- Python::with_gil(|py| {
-+ Python::attach(|py| {
- let is_memoryview = unsafe { ffi::PyMemoryView_Check(self.owner.as_ptr()) } == 1;
- if is_memoryview || self.owner.bind(py).is_instance_of::<PyBytes>() {
- #[cfg(PyPy)]
-@@ -260,13 +259,14 @@
-
- impl Drop for PythonBuffer {
- fn drop(&mut self) {
-- Python::with_gil(|_| unsafe { ffi::PyBuffer_Release(&mut *self.inner) })
-+ Python::attach(|_| unsafe { ffi::PyBuffer_Release(&mut *self.inner) })
- }
- }
-
--impl<'py> FromPyObject<'py> for PythonBuffer {
-- fn extract_bound(obj: &Bound<'py, PyAny>) -> PyResult<Self> {
-- Self::try_from(obj)
-+impl<'a, 'py> FromPyObject<'a, 'py> for PythonBuffer {
-+ type Error = PyErr;
-+ fn extract(obj: Borrowed<'a, 'py, PyAny>) -> PyResult<Self> {
-+ Self::try_from(&*obj)
- }
- }
-
-@@ -285,7 +285,7 @@
- inner: std::pin::Pin::from(buf),
- pos: 0,
- #[cfg(any(PyPy, Py_GIL_DISABLED))]
-- owner: Python::with_gil(|py| obj.into_py_any(py).unwrap()),
-+ owner: obj.clone().unbind(),
- };
- // sanity checks
- if buf.inner.shape.is_null() {
-@@ -629,7 +629,7 @@
- }
- fn __contains__(&self, py: Python, x: BytesType) -> bool {
- let bytes = x.as_bytes();
-- py.allow_threads(|| self.inner.get_ref().windows(bytes.len()).any(|w| w == bytes))
-+ py.detach(|| self.inner.get_ref().windows(bytes.len()).any(|w| w == bytes))
- }
- fn __repr__(&mut self, py: Python) -> PyResult<String> {
- Ok(format!("cramjam.Buffer<len={:?}>", self.len(py)?))
-diff -Naur cramjam-2.11.0-original/src/lib.rs cramjam-2.11.0/src/lib.rs
---- cramjam-2.11.0-original/src/lib.rs 2025-07-27 21:42:07.000000000 +0100
-+++ cramjam-2.11.0/src/lib.rs 2026-06-19 21:25:39.299321450 +0100
-@@ -222,13 +222,13 @@
- BytesType::RustyFile(f) => {
- let borrowed = f.borrow();
- let file = &borrowed.inner;
-- $py.allow_threads(|| {
-+ $py.detach(|| {
- $op(file, &mut Cursor::new(&mut output) $(, $args)* )
- })
- },
- _ => {
- let bytes = $input.as_bytes();
-- $py.allow_threads(|| {
-+ $py.detach(|| {
- $op(bytes, &mut Cursor::new(&mut output) $(, $args)* )
- })
- }
-@@ -246,20 +246,20 @@
- BytesType::RustyFile(f) => {
- let mut borrowed = f.borrow_mut();
- let mut f_out = &mut borrowed.inner;
-- $py.allow_threads(|| {
-+ $py.detach(|| {
- $op(f_in, &mut f_out $(, $args)* )
- })
- },
- BytesType::RustyBuffer(buffer) => {
- let mut borrowed = buffer.borrow_mut();
- let mut buf_out = &mut borrowed.inner;
-- $py.allow_threads(|| {
-+ $py.detach(|| {
- $op(f_in, &mut buf_out $(, $args)* )
- })
- },
- _ => {
- let bytes_out = $output.as_bytes_mut()?;
-- $py.allow_threads(|| {
-+ $py.detach(|| {
- $op(f_in, &mut Cursor::new(bytes_out) $(, $args)* )
- })
- }
-@@ -271,20 +271,20 @@
- BytesType::RustyFile(f) => {
- let mut borrowed = f.borrow_mut();
- let mut f_out = &mut borrowed.inner;
-- $py.allow_threads(|| {
-+ $py.detach(|| {
- $op(bytes_in, &mut f_out $(, $args)* )
- })
- },
- BytesType::RustyBuffer(buffer) => {
- let mut borrowed = buffer.borrow_mut();
- let mut buf_out = &mut borrowed.inner;
-- $py.allow_threads(|| {
-+ $py.detach(|| {
- $op(bytes_in, &mut buf_out $(, $args)* )
- })
- },
- _ => {
- let bytes_out = $output.as_bytes_mut()?;
-- $py.allow_threads(|| {
-+ $py.detach(|| {
- $op(bytes_in, &mut Cursor::new(bytes_out) $(, $args)*)
- })
- }
-@@ -331,11 +331,11 @@
- BytesType::RustyFile(f) => {
- let mut borrowed = f.borrow_mut();
- let f_in = &mut borrowed.inner;
-- py.allow_threads(|| libcramjam::$codec::decompress(f_in, inner).map_err(Into::into))
-+ py.detach(|| libcramjam::$codec::decompress(f_in, inner).map_err(Into::into))
- }
- _ => {
- let bytes = input.as_bytes();
-- py.allow_threads(|| {
-+ py.detach(|| {
- libcramjam::$codec::decompress(&mut Cursor::new(bytes), inner).map_err(Into::into)
- })
- }
-@@ -377,7 +377,7 @@
- }
- fn __contains__(&self, py: Python, x: BytesType) -> bool {
- let bytes = x.as_bytes();
-- py.allow_threads(|| {
-+ py.detach(|| {
- self.inner
- .as_ref()
- .map(|c| c.get_ref().windows(bytes.len()).any(|w| w == bytes))
-diff -Naur cramjam-2.11.0-original/src/lz4.rs cramjam-2.11.0/src/lz4.rs
---- cramjam-2.11.0-original/src/lz4.rs 2025-07-27 21:42:07.000000000 +0100
-+++ cramjam-2.11.0/src/lz4.rs 2026-06-19 21:25:39.299458812 +0100
-@@ -81,7 +81,7 @@
- pub fn decompress_block(py: Python, data: BytesType, output_len: Option<usize>) -> PyResult<RustyBuffer> {
- let bytes = data.as_bytes();
-
-- py.allow_threads(|| {
-+ py.detach(|| {
- match output_len {
- Some(n) => {
- let mut buf = vec![0u8; n];
-@@ -123,7 +123,7 @@
- store_size: Option<bool>,
- ) -> PyResult<RustyBuffer> {
- let bytes = data.as_bytes();
-- py.allow_threads(|| {
-+ py.detach(|| {
- libcramjam::lz4::block::compress_vec(bytes, compression.map(|v| v as _), acceleration, store_size)
- })
- .map_err(CompressionError::from_err)
-@@ -160,7 +160,7 @@
- }
-
- let out_bytes = output.as_bytes_mut()?;
-- py.allow_threads(
-+ py.detach(
- || match libcramjam::lz4::block::decompress_into(bytes, out_bytes, Some(size_stored)) {
- Ok(r) => Ok(r),
- // Fallback and try negation of stored size, incase we/they got it wrong;
-@@ -202,7 +202,7 @@
- ) -> PyResult<usize> {
- let bytes = data.as_bytes();
- let out_bytes = output.as_bytes_mut()?;
-- py.allow_threads(|| {
-+ py.detach(|| {
- libcramjam::lz4::block::compress_into(
- bytes,
- out_bytes,
-diff -Naur cramjam-2.11.0-original/src/snappy.rs cramjam-2.11.0/src/snappy.rs
---- cramjam-2.11.0-original/src/snappy.rs 2025-07-27 21:42:07.000000000 +0100
-+++ cramjam-2.11.0/src/snappy.rs 2026-06-19 21:25:39.299551963 +0100
-@@ -54,7 +54,7 @@
- #[pyo3(signature = (data, output_len=None))]
- pub fn decompress_raw(py: Python, data: BytesType, output_len: Option<usize>) -> PyResult<RustyBuffer> {
- let bytes = data.as_bytes();
-- py.allow_threads(|| libcramjam::snappy::raw::decompress_vec(bytes))
-+ py.detach(|| libcramjam::snappy::raw::decompress_vec(bytes))
- .map_err(DecompressionError::from_err)
- .map(From::from)
- }
-@@ -72,7 +72,7 @@
- #[pyo3(signature = (data, output_len=None))]
- pub fn compress_raw(py: Python, data: BytesType, output_len: Option<usize>) -> PyResult<RustyBuffer> {
- let bytes = data.as_bytes();
-- py.allow_threads(|| libcramjam::snappy::raw::compress_vec(bytes))
-+ py.detach(|| libcramjam::snappy::raw::compress_vec(bytes))
- .map_err(CompressionError::from_err)
- .map(From::from)
- }
-@@ -94,7 +94,7 @@
- pub fn compress_raw_into(py: Python, input: BytesType, mut output: BytesType) -> PyResult<usize> {
- let bytes_in = input.as_bytes();
- let bytes_out = output.as_bytes_mut()?;
-- py.allow_threads(|| libcramjam::snappy::raw::compress(bytes_in, bytes_out))
-+ py.detach(|| libcramjam::snappy::raw::compress(bytes_in, bytes_out))
- .map_err(CompressionError::from_err)
- }
-
-@@ -103,7 +103,7 @@
- pub fn decompress_raw_into(py: Python, input: BytesType, mut output: BytesType) -> PyResult<usize> {
- let bytes_in = input.as_bytes();
- let bytes_out = output.as_bytes_mut()?;
-- py.allow_threads(|| libcramjam::snappy::raw::decompress(bytes_in, bytes_out))
-+ py.detach(|| libcramjam::snappy::raw::decompress(bytes_in, bytes_out))
- .map_err(DecompressionError::from_err)
- }
-
-diff -Naur cramjam-2.11.0-original/src/xz.rs cramjam-2.11.0/src/xz.rs
---- cramjam-2.11.0-original/src/xz.rs 2025-07-27 21:42:07.000000000 +0100
-+++ cramjam-2.11.0/src/xz.rs 2026-06-19 21:25:39.299630265 +0100
-@@ -130,7 +130,7 @@
-
- /// Available Filter IDs
- #[derive(Clone, Debug, PartialEq)]
-- #[pyclass(eq, eq_int)]
-+ #[pyclass(eq, eq_int, from_py_object)]
- #[allow(missing_docs)]
- pub enum Filter {
- Arm,
-@@ -150,7 +150,7 @@
-
- /// MatchFinder, used with Options.mf attribute
- #[derive(Clone, Debug, PartialEq)]
-- #[pyclass(eq, eq_int)]
-+ #[pyclass(eq, eq_int, from_py_object)]
- #[allow(missing_docs)]
- pub enum MatchFinder {
- HashChain3,
-@@ -174,7 +174,7 @@
-
- /// MatchFinder, used with Options.mode attribute
- #[derive(Clone, Debug, PartialEq)]
-- #[pyclass(eq, eq_int)]
-+ #[pyclass(eq, eq_int, from_py_object)]
- #[allow(missing_docs)]
- pub enum Mode {
- Fast,
-@@ -192,7 +192,7 @@
- /// FilterChain, similar to the default Python XZ filter chain which is a list of
- /// dicts.
- #[derive(Debug, Clone)]
-- #[pyclass]
-+ #[pyclass(from_py_object)]
- pub struct FilterChain(Vec<FilterChainItem>);
-
- #[pymethods]
-@@ -229,7 +229,7 @@
- /// FilterChainItem. In Python's lzma module, this represents a single dict in the
- /// filter chain list. To be added to the `FilterChain`
- #[derive(Clone, Debug, Default)]
-- #[pyclass]
-+ #[pyclass(from_py_object)]
- pub struct FilterChainItem {
- filter: Filter,
- options: Options,
-@@ -250,7 +250,7 @@
-
- ///
- #[derive(Clone, Debug, Default)]
-- #[pyclass]
-+ #[pyclass(from_py_object)]
- pub struct Options {
- preset: Option<u32>,
- dict_size: Option<u32>,
-@@ -331,7 +331,7 @@
-
- /// Possible formats
- #[derive(Clone, Debug, PartialEq)]
-- #[pyclass(eq, eq_int)]
-+ #[pyclass(eq, eq_int, from_py_object)]
- pub enum Format {
- /// Auto select the format, for compression this is XZ,
- /// for decompression it will be determined by the compressed input.
-@@ -362,7 +362,7 @@
-
- /// Possible Check configurations
- #[derive(Debug, Clone, PartialEq)]
-- #[pyclass(eq, eq_int)]
-+ #[pyclass(eq, eq_int, from_py_object)]
- #[allow(missing_docs)]
- pub enum Check {
- Crc64,
diff --git a/cramjam-2.11.0-pyo3-0.29.patch b/cramjam-2.11.0-pyo3-0.29.patch
new file mode 100644
index 0000000..887ad64
--- /dev/null
+++ b/cramjam-2.11.0-pyo3-0.29.patch
@@ -0,0 +1,368 @@
+diff -Naur cramjam-2.11.0-original/Cargo.toml cramjam-2.11.0/Cargo.toml
+--- cramjam-2.11.0-original/Cargo.toml 1970-01-01 01:00:00.000000000 +0100
++++ cramjam-2.11.0/Cargo.toml 2026-06-19 21:25:39.298774732 +0100
+@@ -71,11 +71,11 @@
+
+
+ [dependencies]
+-pyo3 = { version = "^0.25", default-features = false, features = ["macros"] }
++pyo3 = { version = "^0.29", default-features = false, features = ["macros"] }
+ libcramjam = { version = "^0.8", default-features = false }
+
+ [build-dependencies]
+-pyo3-build-config = "^0.25"
++pyo3-build-config = "^0.29"
+
+ [profile.release]
+ strip = true
+diff -Naur cramjam-2.11.0-original/pyproject.toml cramjam-2.11.0/pyproject.toml
+--- cramjam-2.11.0-original/pyproject.toml 2025-07-27 21:42:07.000000000 +0100
++++ cramjam-2.11.0/pyproject.toml 2026-06-19 21:25:56.572961647 +0100
+@@ -2,7 +2,7 @@
+ name = "cramjam"
+ version = "2.11.0"
+ keywords = ["compression", "decompression", "snappy", "zstd", "bz2", "gzip", "lz4", "brotli", "deflate", "blosc2"]
+-requires-python = ">=3.8"
++requires-python = ">=3.11"
+ license = { file = "LICENSE" }
+
+ [project.urls]
+diff -Naur cramjam-2.11.0-original/src/blosc2.rs cramjam-2.11.0/src/blosc2.rs
+--- cramjam-2.11.0-original/src/blosc2.rs 2025-07-27 21:42:07.000000000 +0100
++++ cramjam-2.11.0/src/blosc2.rs 2026-06-19 21:25:39.298994605 +0100
+@@ -143,7 +143,7 @@
+ pub fn decompress_chunk(py: Python, data: BytesType, output_len: Option<usize>) -> PyResult<RustyBuffer> {
+ let bytes = data.as_bytes();
+ let buf = py
+- .allow_threads(|| libcramjam::blosc2::decompress_chunk(bytes))
++ .detach(|| libcramjam::blosc2::decompress_chunk(bytes))
+ .map(RustyBuffer::from)?;
+ Ok(buf)
+ }
+@@ -153,7 +153,7 @@
+ pub fn decompress_chunk_into(py: Python, input: BytesType, mut output: BytesType) -> PyResult<usize> {
+ let bytes = input.as_bytes();
+ let out = output.as_bytes_mut()?;
+- let nbytes = py.allow_threads(|| libcramjam::blosc2::decompress_chunk_into(bytes, out))?;
++ let nbytes = py.detach(|| libcramjam::blosc2::decompress_chunk_into(bytes, out))?;
+ Ok(nbytes)
+ }
+
+@@ -176,7 +176,7 @@
+ codec: Option<PyCodec>,
+ ) -> PyResult<RustyBuffer> {
+ let bytes = data.as_bytes();
+- py.allow_threads(|| {
++ py.detach(|| {
+ let clevel = clevel.map(Into::into);
+ let filter = filter.map(Into::into);
+ let codec = codec.map(Into::into);
+@@ -200,7 +200,7 @@
+ ) -> PyResult<usize> {
+ let bytes = input.as_bytes();
+ let out = output.as_bytes_mut()?;
+- py.allow_threads(|| {
++ py.detach(|| {
+ let clevel = clevel.map(Into::into);
+ let filter = filter.map(Into::into);
+ let codec = codec.map(Into::into);
+diff -Naur cramjam-2.11.0-original/src/io.rs cramjam-2.11.0/src/io.rs
+--- cramjam-2.11.0-original/src/io.rs 2025-07-27 21:42:07.000000000 +0100
++++ cramjam-2.11.0/src/io.rs 2026-06-19 21:25:39.299162587 +0100
+@@ -14,7 +14,6 @@
+ use pyo3::ffi;
+ use pyo3::prelude::*;
+ use pyo3::types::PyBytes;
+-use pyo3::IntoPyObjectExt;
+ use std::path::PathBuf;
+
+ pub(crate) trait AsBytes {
+@@ -210,7 +209,7 @@
+ pub fn as_slice_mut(&mut self) -> PyResult<&mut [u8]> {
+ #[cfg(any(PyPy, Py_GIL_DISABLED))]
+ {
+- Python::with_gil(|py| {
++ Python::attach(|py| {
+ let is_memoryview = unsafe { ffi::PyMemoryView_Check(self.owner.as_ptr()) } == 1;
+ if is_memoryview || self.owner.bind(py).is_instance_of::<PyBytes>() {
+ #[cfg(PyPy)]
+@@ -260,13 +259,14 @@
+
+ impl Drop for PythonBuffer {
+ fn drop(&mut self) {
+- Python::with_gil(|_| unsafe { ffi::PyBuffer_Release(&mut *self.inner) })
++ Python::attach(|_| unsafe { ffi::PyBuffer_Release(&mut *self.inner) })
+ }
+ }
+
+-impl<'py> FromPyObject<'py> for PythonBuffer {
+- fn extract_bound(obj: &Bound<'py, PyAny>) -> PyResult<Self> {
+- Self::try_from(obj)
++impl<'a, 'py> FromPyObject<'a, 'py> for PythonBuffer {
++ type Error = PyErr;
++ fn extract(obj: Borrowed<'a, 'py, PyAny>) -> PyResult<Self> {
++ Self::try_from(&*obj)
+ }
+ }
+
+@@ -285,7 +285,7 @@
+ inner: std::pin::Pin::from(buf),
+ pos: 0,
+ #[cfg(any(PyPy, Py_GIL_DISABLED))]
+- owner: Python::with_gil(|py| obj.into_py_any(py).unwrap()),
++ owner: obj.clone().unbind(),
+ };
+ // sanity checks
+ if buf.inner.shape.is_null() {
+@@ -629,7 +629,7 @@
+ }
+ fn __contains__(&self, py: Python, x: BytesType) -> bool {
+ let bytes = x.as_bytes();
+- py.allow_threads(|| self.inner.get_ref().windows(bytes.len()).any(|w| w == bytes))
++ py.detach(|| self.inner.get_ref().windows(bytes.len()).any(|w| w == bytes))
+ }
+ fn __repr__(&mut self, py: Python) -> PyResult<String> {
+ Ok(format!("cramjam.Buffer<len={:?}>", self.len(py)?))
+diff -Naur cramjam-2.11.0-original/src/lib.rs cramjam-2.11.0/src/lib.rs
+--- cramjam-2.11.0-original/src/lib.rs 2025-07-27 21:42:07.000000000 +0100
++++ cramjam-2.11.0/src/lib.rs 2026-06-19 21:25:39.299321450 +0100
+@@ -222,13 +222,13 @@
+ BytesType::RustyFile(f) => {
+ let borrowed = f.borrow();
+ let file = &borrowed.inner;
+- $py.allow_threads(|| {
++ $py.detach(|| {
+ $op(file, &mut Cursor::new(&mut output) $(, $args)* )
+ })
+ },
+ _ => {
+ let bytes = $input.as_bytes();
+- $py.allow_threads(|| {
++ $py.detach(|| {
+ $op(bytes, &mut Cursor::new(&mut output) $(, $args)* )
+ })
+ }
+@@ -246,20 +246,20 @@
+ BytesType::RustyFile(f) => {
+ let mut borrowed = f.borrow_mut();
+ let mut f_out = &mut borrowed.inner;
+- $py.allow_threads(|| {
++ $py.detach(|| {
+ $op(f_in, &mut f_out $(, $args)* )
+ })
+ },
+ BytesType::RustyBuffer(buffer) => {
+ let mut borrowed = buffer.borrow_mut();
+ let mut buf_out = &mut borrowed.inner;
+- $py.allow_threads(|| {
++ $py.detach(|| {
+ $op(f_in, &mut buf_out $(, $args)* )
+ })
+ },
+ _ => {
+ let bytes_out = $output.as_bytes_mut()?;
+- $py.allow_threads(|| {
++ $py.detach(|| {
+ $op(f_in, &mut Cursor::new(bytes_out) $(, $args)* )
+ })
+ }
+@@ -271,20 +271,20 @@
+ BytesType::RustyFile(f) => {
+ let mut borrowed = f.borrow_mut();
+ let mut f_out = &mut borrowed.inner;
+- $py.allow_threads(|| {
++ $py.detach(|| {
+ $op(bytes_in, &mut f_out $(, $args)* )
+ })
+ },
+ BytesType::RustyBuffer(buffer) => {
+ let mut borrowed = buffer.borrow_mut();
+ let mut buf_out = &mut borrowed.inner;
+- $py.allow_threads(|| {
++ $py.detach(|| {
+ $op(bytes_in, &mut buf_out $(, $args)* )
+ })
+ },
+ _ => {
+ let bytes_out = $output.as_bytes_mut()?;
+- $py.allow_threads(|| {
++ $py.detach(|| {
+ $op(bytes_in, &mut Cursor::new(bytes_out) $(, $args)*)
+ })
+ }
+@@ -331,11 +331,11 @@
+ BytesType::RustyFile(f) => {
+ let mut borrowed = f.borrow_mut();
+ let f_in = &mut borrowed.inner;
+- py.allow_threads(|| libcramjam::$codec::decompress(f_in, inner).map_err(Into::into))
++ py.detach(|| libcramjam::$codec::decompress(f_in, inner).map_err(Into::into))
+ }
+ _ => {
+ let bytes = input.as_bytes();
+- py.allow_threads(|| {
++ py.detach(|| {
+ libcramjam::$codec::decompress(&mut Cursor::new(bytes), inner).map_err(Into::into)
+ })
+ }
+@@ -377,7 +377,7 @@
+ }
+ fn __contains__(&self, py: Python, x: BytesType) -> bool {
+ let bytes = x.as_bytes();
+- py.allow_threads(|| {
++ py.detach(|| {
+ self.inner
+ .as_ref()
+ .map(|c| c.get_ref().windows(bytes.len()).any(|w| w == bytes))
+diff -Naur cramjam-2.11.0-original/src/lz4.rs cramjam-2.11.0/src/lz4.rs
+--- cramjam-2.11.0-original/src/lz4.rs 2025-07-27 21:42:07.000000000 +0100
++++ cramjam-2.11.0/src/lz4.rs 2026-06-19 21:25:39.299458812 +0100
+@@ -81,7 +81,7 @@
+ pub fn decompress_block(py: Python, data: BytesType, output_len: Option<usize>) -> PyResult<RustyBuffer> {
+ let bytes = data.as_bytes();
+
+- py.allow_threads(|| {
++ py.detach(|| {
+ match output_len {
+ Some(n) => {
+ let mut buf = vec![0u8; n];
+@@ -123,7 +123,7 @@
+ store_size: Option<bool>,
+ ) -> PyResult<RustyBuffer> {
+ let bytes = data.as_bytes();
+- py.allow_threads(|| {
++ py.detach(|| {
+ libcramjam::lz4::block::compress_vec(bytes, compression.map(|v| v as _), acceleration, store_size)
+ })
+ .map_err(CompressionError::from_err)
+@@ -160,7 +160,7 @@
+ }
+
+ let out_bytes = output.as_bytes_mut()?;
+- py.allow_threads(
++ py.detach(
+ || match libcramjam::lz4::block::decompress_into(bytes, out_bytes, Some(size_stored)) {
+ Ok(r) => Ok(r),
+ // Fallback and try negation of stored size, incase we/they got it wrong;
+@@ -202,7 +202,7 @@
+ ) -> PyResult<usize> {
+ let bytes = data.as_bytes();
+ let out_bytes = output.as_bytes_mut()?;
+- py.allow_threads(|| {
++ py.detach(|| {
+ libcramjam::lz4::block::compress_into(
+ bytes,
+ out_bytes,
+diff -Naur cramjam-2.11.0-original/src/snappy.rs cramjam-2.11.0/src/snappy.rs
+--- cramjam-2.11.0-original/src/snappy.rs 2025-07-27 21:42:07.000000000 +0100
++++ cramjam-2.11.0/src/snappy.rs 2026-06-19 21:25:39.299551963 +0100
+@@ -54,7 +54,7 @@
+ #[pyo3(signature = (data, output_len=None))]
+ pub fn decompress_raw(py: Python, data: BytesType, output_len: Option<usize>) -> PyResult<RustyBuffer> {
+ let bytes = data.as_bytes();
+- py.allow_threads(|| libcramjam::snappy::raw::decompress_vec(bytes))
++ py.detach(|| libcramjam::snappy::raw::decompress_vec(bytes))
+ .map_err(DecompressionError::from_err)
+ .map(From::from)
+ }
+@@ -72,7 +72,7 @@
+ #[pyo3(signature = (data, output_len=None))]
+ pub fn compress_raw(py: Python, data: BytesType, output_len: Option<usize>) -> PyResult<RustyBuffer> {
+ let bytes = data.as_bytes();
+- py.allow_threads(|| libcramjam::snappy::raw::compress_vec(bytes))
++ py.detach(|| libcramjam::snappy::raw::compress_vec(bytes))
+ .map_err(CompressionError::from_err)
+ .map(From::from)
+ }
+@@ -94,7 +94,7 @@
+ pub fn compress_raw_into(py: Python, input: BytesType, mut output: BytesType) -> PyResult<usize> {
+ let bytes_in = input.as_bytes();
+ let bytes_out = output.as_bytes_mut()?;
+- py.allow_threads(|| libcramjam::snappy::raw::compress(bytes_in, bytes_out))
++ py.detach(|| libcramjam::snappy::raw::compress(bytes_in, bytes_out))
+ .map_err(CompressionError::from_err)
+ }
+
+@@ -103,7 +103,7 @@
+ pub fn decompress_raw_into(py: Python, input: BytesType, mut output: BytesType) -> PyResult<usize> {
+ let bytes_in = input.as_bytes();
+ let bytes_out = output.as_bytes_mut()?;
+- py.allow_threads(|| libcramjam::snappy::raw::decompress(bytes_in, bytes_out))
++ py.detach(|| libcramjam::snappy::raw::decompress(bytes_in, bytes_out))
+ .map_err(DecompressionError::from_err)
+ }
+
+diff -Naur cramjam-2.11.0-original/src/xz.rs cramjam-2.11.0/src/xz.rs
+--- cramjam-2.11.0-original/src/xz.rs 2025-07-27 21:42:07.000000000 +0100
++++ cramjam-2.11.0/src/xz.rs 2026-06-19 21:25:39.299630265 +0100
+@@ -130,7 +130,7 @@
+
+ /// Available Filter IDs
+ #[derive(Clone, Debug, PartialEq)]
+- #[pyclass(eq, eq_int)]
++ #[pyclass(eq, eq_int, from_py_object)]
+ #[allow(missing_docs)]
+ pub enum Filter {
+ Arm,
+@@ -150,7 +150,7 @@
+
+ /// MatchFinder, used with Options.mf attribute
+ #[derive(Clone, Debug, PartialEq)]
+- #[pyclass(eq, eq_int)]
++ #[pyclass(eq, eq_int, from_py_object)]
+ #[allow(missing_docs)]
+ pub enum MatchFinder {
+ HashChain3,
+@@ -174,7 +174,7 @@
+
+ /// MatchFinder, used with Options.mode attribute
+ #[derive(Clone, Debug, PartialEq)]
+- #[pyclass(eq, eq_int)]
++ #[pyclass(eq, eq_int, from_py_object)]
+ #[allow(missing_docs)]
+ pub enum Mode {
+ Fast,
+@@ -192,7 +192,7 @@
+ /// FilterChain, similar to the default Python XZ filter chain which is a list of
+ /// dicts.
+ #[derive(Debug, Clone)]
+- #[pyclass]
++ #[pyclass(from_py_object)]
+ pub struct FilterChain(Vec<FilterChainItem>);
+
+ #[pymethods]
+@@ -229,7 +229,7 @@
+ /// FilterChainItem. In Python's lzma module, this represents a single dict in the
+ /// filter chain list. To be added to the `FilterChain`
+ #[derive(Clone, Debug, Default)]
+- #[pyclass]
++ #[pyclass(from_py_object)]
+ pub struct FilterChainItem {
+ filter: Filter,
+ options: Options,
+@@ -250,7 +250,7 @@
+
+ ///
+ #[derive(Clone, Debug, Default)]
+- #[pyclass]
++ #[pyclass(from_py_object)]
+ pub struct Options {
+ preset: Option<u32>,
+ dict_size: Option<u32>,
+@@ -331,7 +331,7 @@
+
+ /// Possible formats
+ #[derive(Clone, Debug, PartialEq)]
+- #[pyclass(eq, eq_int)]
++ #[pyclass(eq, eq_int, from_py_object)]
+ pub enum Format {
+ /// Auto select the format, for compression this is XZ,
+ /// for decompression it will be determined by the compressed input.
+@@ -362,7 +362,7 @@
+
+ /// Possible Check configurations
+ #[derive(Debug, Clone, PartialEq)]
+- #[pyclass(eq, eq_int)]
++ #[pyclass(eq, eq_int, from_py_object)]
+ #[allow(missing_docs)]
+ pub enum Check {
+ Crc64,
diff --git a/python-cramjam.spec b/python-cramjam.spec
index a9eed00..2809443 100644
--- a/python-cramjam.spec
+++ b/python-cramjam.spec
@@ -37,7 +37,11 @@ Source1: get_source
# https://github.com/milesgranger/cramjam/pull/240
# Rebased on 2.11.0. Without changes to Cargo.lock and
# .github/workflows/CI.yml, which are not relevant downstream.
-Patch: cramjam-2.11.0-pyo3-0.28.patch
+#
+# Further update to 0.29, without source-code changes, introducing one new
+# deprecation warning as noted in
+# https://github.com/milesgranger/cramjam/pull/240#issuecomment-4756886599.
+Patch: cramjam-2.11.0-pyo3-0.29.patch
BuildRequires: tomcli
BuildRequires: cargo-rpm-macros >= 24
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-29 14:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-29 14:46 [rpms/python-cramjam] epel10: Update to PyO3 0.29 Benjamin A. Beasley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox