diff -Nru pikepdf-1.17.3+dfsg/debian/changelog pikepdf-1.17.3+dfsg/debian/changelog --- pikepdf-1.17.3+dfsg/debian/changelog 2020-07-26 22:47:36.000000000 +0000 +++ pikepdf-1.17.3+dfsg/debian/changelog 2020-12-09 10:35:14.000000000 +0000 @@ -1,3 +1,10 @@ +pikepdf (1.17.3+dfsg-1+rpi1) bullseye-staging; urgency=medium + + [Changes taken from 1.17.3+dfsg-1ubuntu1 by Matthias Klose] + * Fix compatibility with pybind11. Closes: #975202. + + -- Matthias Klose Wed, 09 Dec 2020 11:35:14 +0100 + pikepdf (1.17.3+dfsg-1) unstable; urgency=medium * New upstream release. diff -Nru pikepdf-1.17.3+dfsg/debian/patches/5394b7855eb87f637316432b2b597294adcb974e.diff pikepdf-1.17.3+dfsg/debian/patches/5394b7855eb87f637316432b2b597294adcb974e.diff --- pikepdf-1.17.3+dfsg/debian/patches/5394b7855eb87f637316432b2b597294adcb974e.diff 1970-01-01 00:00:00.000000000 +0000 +++ pikepdf-1.17.3+dfsg/debian/patches/5394b7855eb87f637316432b2b597294adcb974e.diff 2020-12-09 10:35:14.000000000 +0000 @@ -0,0 +1,72 @@ +diff --git a/src/qpdf/pipeline.cpp b/src/qpdf/pipeline.cpp +index 1856987..8a4fe79 100644 +--- a/src/qpdf/pipeline.cpp ++++ b/src/qpdf/pipeline.cpp +@@ -22,6 +22,7 @@ + + #include "pikepdf.h" + #include "pipeline.h" ++#include "utils.h" + + + void Pl_PythonOutput::write(unsigned char *buf, size_t len) +@@ -29,8 +30,7 @@ void Pl_PythonOutput::write(unsigned char *buf, size_t len) + py::gil_scoped_acquire gil; + ssize_t so_far = 0; + while (len > 0) { +- py::buffer_info buffer(buf, len); +- py::memoryview view_buffer(buffer); ++ py::memoryview view_buffer = memoryview_from_memory(buf, len); + py::object result = this->stream.attr("write")(view_buffer); + try { + so_far = result.cast(); +diff --git a/src/qpdf/qpdf_inputsource.h b/src/qpdf/qpdf_inputsource.h +index 4a96f6b..8ec6a55 100644 +--- a/src/qpdf/qpdf_inputsource.h ++++ b/src/qpdf/qpdf_inputsource.h +@@ -82,8 +82,7 @@ class PythonStreamInputSource : public InputSource + { + py::gil_scoped_acquire gil; + +- py::buffer_info buffer_info(buffer, length); +- py::memoryview view_buffer_info(buffer_info); ++ py::memoryview view_buffer_info = memoryview_from_memory(buffer, length); + + this->last_offset = this->tell(); + py::object result = this->stream.attr("readinto")(view_buffer_info); +diff --git a/src/qpdf/utils.cpp b/src/qpdf/utils.cpp +index bf189f6..36769ca 100644 +--- a/src/qpdf/utils.cpp ++++ b/src/qpdf/utils.cpp +@@ -46,3 +46,20 @@ + } + + #endif ++ ++// Copied from pybind11 master branch (pre-2.6), can remove when we require ++// pybind11 v2.6 and replace with py::memoryview::from_memory ++py::memoryview memoryview_from_memory(void *mem, ssize_t size, bool readonly) ++{ ++ PyObject* ptr = PyMemoryView_FromMemory( ++ reinterpret_cast(mem), size, ++ (readonly) ? PyBUF_READ : PyBUF_WRITE); ++ if (!ptr) ++ py::pybind11_fail("Could not allocate memoryview object!"); ++ return py::reinterpret_steal(ptr); ++} ++ ++py::memoryview memoryview_from_memory(const void *mem, ssize_t size) ++{ ++ return memoryview_from_memory(const_cast(mem), size, true); ++} +diff --git a/src/qpdf/utils.h b/src/qpdf/utils.h +index 9f6a411..f26c5bd 100644 +--- a/src/qpdf/utils.h ++++ b/src/qpdf/utils.h +@@ -17,3 +17,6 @@ inline bool str_startswith(T haystack, S needle) + { + return std::string(haystack).rfind(needle, 0) == 0; + } ++ ++py::memoryview memoryview_from_memory(void *mem, ssize_t size, bool readonly = false); ++py::memoryview memoryview_from_memory(const void *mem, ssize_t size); diff -Nru pikepdf-1.17.3+dfsg/debian/patches/series pikepdf-1.17.3+dfsg/debian/patches/series --- pikepdf-1.17.3+dfsg/debian/patches/series 2020-07-26 22:47:36.000000000 +0000 +++ pikepdf-1.17.3+dfsg/debian/patches/series 2020-12-09 10:35:14.000000000 +0000 @@ -2,3 +2,4 @@ drop-installation-from-docs-contents.patch drop-pybind11-from-setup.py.patch drop-save-pike.patch +5394b7855eb87f637316432b2b597294adcb974e.diff