Control: tags 1114321 + patch
Control: tags 1114321 + pending

Dear maintainer,

I've prepared an NMU for python-pycddl (versioned as 0.6.4+ds-1.1) and 
uploaded it to DELAYED/14. Please feel free to tell me if I should 
cancel it.

cu
Adrian
diffstat for python-pycddl-0.6.4+ds python-pycddl-0.6.4+ds

 changelog                                         |    7 +
 patches/0001-Adapt-library-to-pyo3-0.23-API.patch |  119 ++++++++++++++++++++++
 patches/pyo3-0.26.patch                           |   20 +++
 patches/series                                    |    2 
 4 files changed, 148 insertions(+)

diff -Nru python-pycddl-0.6.4+ds/debian/changelog python-pycddl-0.6.4+ds/debian/changelog
--- python-pycddl-0.6.4+ds/debian/changelog	2025-06-13 10:45:04.000000000 +0300
+++ python-pycddl-0.6.4+ds/debian/changelog	2025-11-07 18:26:35.000000000 +0200
@@ -1,3 +1,10 @@
+python-pycddl (0.6.4+ds-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Patch for pyo3 0.26. (Closes: #1114321)
+
+ -- Adrian Bunk <[email protected]>  Fri, 07 Nov 2025 18:26:35 +0200
+
 python-pycddl (0.6.4+ds-1) unstable; urgency=medium
 
   * New upstream version 0.6.4+ds
diff -Nru python-pycddl-0.6.4+ds/debian/patches/0001-Adapt-library-to-pyo3-0.23-API.patch python-pycddl-0.6.4+ds/debian/patches/0001-Adapt-library-to-pyo3-0.23-API.patch
--- python-pycddl-0.6.4+ds/debian/patches/0001-Adapt-library-to-pyo3-0.23-API.patch	1970-01-01 02:00:00.000000000 +0200
+++ python-pycddl-0.6.4+ds/debian/patches/0001-Adapt-library-to-pyo3-0.23-API.patch	2025-11-07 18:26:35.000000000 +0200
@@ -0,0 +1,119 @@
+From c3201cd144c332a3672e11dd0a4ee0f1e40ea552 Mon Sep 17 00:00:00 2001
+From: Florian Sesser <[email protected]>
+Date: Fri, 3 Oct 2025 11:29:01 +0000
+Subject: Adapt library to pyo3 0.23 API
+
+Replace deprecated into_py with into_pyobject and unbind.
+This is slop, and it doesn't seem very elegant, but it passes
+the tests so I guess it's better than nothing.
+
+refactor: migrate from PyO3 0.22 to 0.25 API
+fix: replace deprecated into_py with into_pyobject and unbind
+fix: convert Py<T> to Py<PyAny> in deserialize functions
+fix: clone borrowed PyBool before unbinding to prevent move error
+fix: convert borrowed PyBool to owned Bound before unbinding
+fix: import BoundObject trait to resolve into_bound method
+refactor: use idiomatic PyO3 0.25 conversion pattern with into_any().unbind()
+
+Co-authored-by: aider (anthropic/claude-sonnet-4-5-20250929) <[email protected]>
+---
+ src/deserialize.rs | 26 +++++++++++++-------------
+ src/lib.rs         |  6 +++---
+ 2 files changed, 16 insertions(+), 16 deletions(-)
+
+diff --git a/src/deserialize.rs b/src/deserialize.rs
+index f12835b..d623233 100644
+--- a/src/deserialize.rs
++++ b/src/deserialize.rs
+@@ -1,32 +1,32 @@
+ //! Deserialize CBOR to Python objects.
+ 
+ use ciborium::value::Value;
+-use pyo3::{prelude::*, types::{PyNone, PyList, PyDict, PyBytes, PySet}, exceptions::PyValueError};
++use pyo3::{prelude::*, types::{PyList, PyDict, PyBytes, PySet}, exceptions::PyValueError, BoundObject};
+ 
+ /// Convert a CBOR value into an equivalent tree of Python objects.
+ pub fn deserialize(py: Python<'_>, value: &Value) -> PyResult<PyObject> {
+     match value {
+-        Value::Integer(int) => Ok(i128::from(*int).to_object(py)),
+-        Value::Bytes(vec) => Ok(PyBytes::new_bound(py, vec).to_object(py)),
+-        Value::Float(float) => Ok(float.to_object(py)),
+-        Value::Text(string) => Ok(string.to_object(py)),
+-        Value::Bool(boolean) => Ok(boolean.to_object(py)),
+-        Value::Null => Ok(PyNone::get_bound(py).to_object(py)),
++        Value::Integer(int) => Ok(i128::from(*int).into_pyobject(py)?.into_any().unbind()),
++        Value::Bytes(vec) => Ok(PyBytes::new(py, vec).into_any().unbind()),
++        Value::Float(float) => Ok(float.into_pyobject(py)?.into_any().unbind()),
++        Value::Text(string) => Ok(string.into_pyobject(py)?.into_any().unbind()),
++        Value::Bool(boolean) => Ok(boolean.into_pyobject(py)?.into_any().unbind()),
++        Value::Null => Ok(py.None()),
+         Value::Array(array_values) => {
+-            let result = PyList::empty_bound(py);
++            let result = PyList::empty(py);
+             for array_value in array_values {
+                 result.append(deserialize(py, array_value)?)?;
+             }
+-            Ok(result.to_object(py))
++            Ok(result.into_any().unbind())
+         },
+         Value::Map(map_pairs) => {
+-            let result = PyDict::new_bound(py);
++            let result = PyDict::new(py);
+             for (key, value) in map_pairs {
+                 let key = deserialize(py, key)?;
+                 let value = deserialize(py, value)?;
+                 result.set_item(key, value)?;
+             }
+-            Ok(result.to_object(py))
++            Ok(result.into_any().unbind())
+         },
+         Value::Tag(tag, tagged_value) => deserialize_tagged(py, *tag, tagged_value),
+         _ => Err(PyValueError::new_err("Unsupported CBOR type"))
+@@ -37,11 +37,11 @@ pub fn deserialize(py: Python<'_>, value: &Value) -> PyResult<PyObject> {
+ fn deserialize_tagged(py: Python<'_>, tag: u64, value: &Value) -> PyResult<PyObject> {
+     match (tag, value) {
+         (258, Value::Array(array_values)) => {
+-            let result = PySet::empty_bound(py)?;
++            let result = PySet::empty(py)?;
+             for array_value in array_values {
+                 result.add(deserialize(py, array_value)?)?;
+             }
+-            Ok(result.to_object(py))
++            Ok(result.into_any().unbind())
+         },
+         _ =>  Err(PyValueError::new_err(format!("Tag {tag} not yet supported, please file an issue at https://gitlab.com/tahoe-lafs/pycddl";))),
+     }
+diff --git a/src/lib.rs b/src/lib.rs
+index 04dc695..6541030 100644
+--- a/src/lib.rs
++++ b/src/lib.rs
+@@ -51,7 +51,7 @@ impl Schema {
+     /// will be deserialized to Python objects and returned.
+     #[pyo3(signature = (cbor, deserialize=false))]
+     fn validate_cbor(&self, py: Python<'_>, cbor: &Bound<'_, PyAny>, deserialize: bool) -> PyResult<PyObject> {
+-        let buffer = PyBuffer::<u8>::get_bound(cbor)?;
++        let buffer = PyBuffer::<u8>::get(cbor)?;
+         // PyPy has weird issues with this flag.
+         if !cfg!(PyPy) && !buffer.readonly() {
+             return Err(PyValueError::new_err("Must be a read-only byte buffer (and you should never mutate it during validation)"));
+@@ -108,7 +108,7 @@ impl Schema {
+             .expect("This should never error since this is the second time we're parsing...");
+             crate::deserialize::deserialize(py, &parsed_cbor)
+         } else {
+-            Ok(None::<()>.to_object(py))
++            Ok(py.None())
+         }
+     }
+ }
+@@ -117,7 +117,7 @@ create_exception!(pycddl, ValidationError, PyException);
+ 
+ #[pymodule]
+ fn pycddl(py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
+-    m.add("ValidationError", py.get_type_bound::<ValidationError>())?;
++    m.add("ValidationError", py.get_type::<ValidationError>())?;
+     m.add_class::<Schema>()?;
+     Ok(())
+ }
+-- 
+2.30.2
+
diff -Nru python-pycddl-0.6.4+ds/debian/patches/pyo3-0.26.patch python-pycddl-0.6.4+ds/debian/patches/pyo3-0.26.patch
--- python-pycddl-0.6.4+ds/debian/patches/pyo3-0.26.patch	1970-01-01 02:00:00.000000000 +0200
+++ python-pycddl-0.6.4+ds/debian/patches/pyo3-0.26.patch	2025-11-07 18:26:35.000000000 +0200
@@ -0,0 +1,20 @@
+Description: Patch for pyo3 0.26
+Author: Adrian Bunk <[email protected]>
+Bug-Debian: https://bugs.debian.org/1114321
+
+--- python-pycddl-0.6.4+ds.orig/Cargo.toml
++++ python-pycddl-0.6.4+ds/Cargo.toml
+@@ -18,10 +18,10 @@ crate-type = ["cdylib"]
+ cddl = "0.9.5"
+ ciborium = "0.2"
+ self_cell = "1.0"
+-pyo3 = "0.22"
++pyo3 = "0.26"
+ 
+ [build-dependencies]
+-pyo3-build-config = { version = "0.22", features = ["resolve-config"] }
++pyo3-build-config = { version = "0.26", features = ["resolve-config"] }
+ 
+ [profile.release]
+ lto = "thin"
+\ No newline at end of file
diff -Nru python-pycddl-0.6.4+ds/debian/patches/series python-pycddl-0.6.4+ds/debian/patches/series
--- python-pycddl-0.6.4+ds/debian/patches/series	1970-01-01 02:00:00.000000000 +0200
+++ python-pycddl-0.6.4+ds/debian/patches/series	2025-11-07 18:26:35.000000000 +0200
@@ -0,0 +1,2 @@
+0001-Adapt-library-to-pyo3-0.23-API.patch
+pyo3-0.26.patch

Reply via email to