python-poppler icon indicating copy to clipboard operation
python-poppler copied to clipboard

Fix: Remove image.copy() argument in poppler 25.01

Open bzamecnik opened this issue 10 months ago • 5 comments

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.

bzamecnik avatar Jan 16 '25 09:01 bzamecnik

This worked for me as well.

dgravitate avatar Jan 22 '25 17:01 dgravitate

Yet another one #96 (have not seen this PR) Dropped the param from the python side. Hope we will have it IN...

alikefia avatar Mar 05 '25 13:03 alikefia

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.

philpax avatar Mar 05 '25 18:03 philpax

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?

dov avatar Jul 11 '25 06:07 dov

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

vbraun avatar Aug 01 '25 07:08 vbraun