Skip to content
Snippets Groups Projects
Commit c1aa6259 authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Also catch RuntimeError when importing PyPDF so that PyPDF or, crucially, its...

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, #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
bugs #1078747 and #965041 for more details.

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.
parent 12e34398
No related branches found
No related tags found
No related merge requests found
Pipeline #718549 passed
......@@ -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
......
......@@ -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.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment