Fix: Remove image.copy() argument in poppler 25.01
Building the wheel started failing after upgrade to poppler 25.01.
../src/cpp/image.cpp:105:10: note: in instantiation of function template specialization 'pybind11::class_<poppler::image>::def<poppler::image (poppler::image::*)() const, pybind11::arg_v>' requested here
105 | .def("copy", &image::copy, py::arg("rect") = rect())
| ^
1 warning and 1 error generated.
From poppler changelog: "Remove rect parameter from image::copy, it was never implemented".
In src/cpp/image.cpp the image.copy() function should be now declared as:
.def("copy", &image::copy)
instead of:
.def("copy", &image::copy, py::arg("rect") = rect())
i.e. using the HAS_VERISON (fixed like this in the PR):
#if HAS_VERSION(25, 1)
.def("copy", &image::copy)
#else
.def("copy", &image::copy, py::arg("rect") = rect())
#endif
It might be also good to upgrade ubuntu/poppler in .github/workflows/build_and_test.yml.
This worked for me as well.
Yet another one #96 (have not seen this PR) Dropped the param from the python side. Hope we will have it IN...
For reference, how to refer to this PR in your requirements.txt:
python-poppler @ git+https://github.com/bzamecnik/python-poppler.git@fix_image_copy # Poppler 25.01 changed the signature of a bound function, and python-poppler upstream hasn't updated yet.
I failed installing this package with poppler 25 on fedora 42 due to this issue. Applying it fixed the problem. Thanks!
But why isn't the PR merged? Is python-poppler maintained?
This branch works for me, too (Fedora 42)
From the Poppler changelog (https://poppler.freedesktop.org/releases.html)
Poppler 25.01 Releases
poppler-25.01.0.tar.xz (Thu Jan 2, 2025):
[...]
cpp:
* Remove rect parameter from image::copy, it was never implemented
So it is correct to follow upstream and remove the rect parameter here, too