[Git][reproducible-builds/diffoscope][master] Also catch RuntimeError when importing PyPDF so that PyPDF or, crucially, its...
Chris Lamb (@lamby)
gitlab at salsa.debian.org
Sun Aug 18 17:33:32 UTC 2024
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
1f183d58 by Chris Lamb at 2024-08-18T18:22:31+01:00
Also catch RuntimeError when importing PyPDF so that PyPDF or, crucially, its transitive dependencies do not cause diffoscope to traceback at runtime and build time. (Closes: Debian:#1078944, reproducible-builds/diffoscope#389)
The root or even primary cause of this bug is not in diffoscope itself; rather,
the cause is to be found between src:python3-cryptography and src:openssl: see
However, diffoscope should (and easily can…) be mindful that importing external
libraries could result in exceptions other than ImportError when we have reason
to believe that they might do so.
We already do so in fsimage.py for a complicated library (guestfs), so I think
it's not at all unreasonable to catch it here, too.
Alas I can't seem to reproduce this on my local machine or in a clean sid
chroot, so I am uploading the following patch after simply having a hard stare
at the code… albeit on a warm Sunday afternoon.
- - - - -
2 changed files:
- diffoscope/comparators/pdf.py
- tests/comparators/test_pdf.py
Changes:
=====================================
diffoscope/comparators/pdf.py
=====================================
@@ -72,7 +72,7 @@ try:
# PyPDF 1.x
from PyPDF2.utils import PdfReadError
-except ImportError: # noqa
+except (ImportError, RuntimeError): # noqa
python_module_missing("pypdf")
pypdf = None
=====================================
tests/comparators/test_pdf.py
=====================================
@@ -42,7 +42,7 @@ def skip_unless_pypdf3():
def fn():
try:
import pypdf
- except ImportError:
+ except (ImportError, RuntimeError):
return True
return not pypdf.__version__.startswith("3.")
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/1f183d581959ce273ea15c8218053928428f8b0e
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/1f183d581959ce273ea15c8218053928428f8b0e
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20240818/04694f70/attachment.htm>
More information about the rb-commits
mailing list