Fix: catch RuntimeError alongside ImportError for the optional numpy import - #1909
Conversation
|
@allcontributors please add @stumpylog for bug, code |
|
I've put up a pull request to add @stumpylog! 🎉 |
andersonhc
left a comment
There was a problem hiding this comment.
Good to merge. Thank you.
|
Thanks for the merge. If you happen to get time to cut a release, this would be great to include for our users soon. |
|
Hi @andersonhc im one of the other paperless devs, thanks for your work on this project. Is there any chance you would be planning (or willing) to make a release with this change soon? Thanks again |
I am preparing a new release today. Probably a couple hours it should be in pypi. |
|
Oh wow thank you!! |
Fixes #1908
The optional
numpyimport inimage_parsing.pyonly caughtImportError. On CPUs numpy'smanylinuxwheel doesn't support (below itsx86-64-v2baseline as of numpy 2.4.0),import numpyraisesRuntimeErrorinstead, which propagated out ofimport fpdfentirely and crashed every caller, even ones that never touch the numpy-guarded code paths. Both existing call sites (pack_codes_into_bytes(),_has_alpha()) already guard onnumpy is not None, so treatingRuntimeErrorthe same asImportErroris enough to restore the intended "numpy unavailable, fall back" behavior.Checklist:
builtins.__import__, none of which seem feasible or really usefuldocs/folderCHANGELOG.mdBy submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.