Skip to content

Commit 7989919

Browse files
src/utils.py: disable various expected calls to pymupdf.exception_info().
Addresses #3479 and #3488.
1 parent 35332d0 commit 7989919

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/utils.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ def getLinkDict(ln, document=None) -> dict:
933933
nl["from"] = ln.rect
934934
except Exception:
935935
# This seems to happen quite often in PyMuPDF/tests.
936-
if g_exceptions_verbose: pymupdf.exception_info()
936+
if g_exceptions_verbose >= 2: pymupdf.exception_info()
937937
pass
938938
pnt = pymupdf.Point(0, 0)
939939
if dest.flags & pymupdf.LINK_FLAG_L_VALID:
@@ -1444,46 +1444,46 @@ def set_toc(
14441444
txt += ol["dest"]
14451445
except Exception:
14461446
# Verbose in PyMuPDF/tests.
1447-
if g_exceptions_verbose: pymupdf.exception_info()
1447+
if g_exceptions_verbose >= 2: pymupdf.exception_info()
14481448
pass
14491449
try:
14501450
if ol["first"] > -1:
14511451
txt += "/First %i 0 R" % xref[ol["first"]]
14521452
except Exception:
1453-
if g_exceptions_verbose: pymupdf.exception_info()
1453+
if g_exceptions_verbose >= 2: pymupdf.exception_info()
14541454
pass
14551455
try:
14561456
if ol["last"] > -1:
14571457
txt += "/Last %i 0 R" % xref[ol["last"]]
14581458
except Exception:
1459-
if g_exceptions_verbose: pymupdf.exception_info()
1459+
if g_exceptions_verbose >= 2: pymupdf.exception_info()
14601460
pass
14611461
try:
14621462
if ol["next"] > -1:
14631463
txt += "/Next %i 0 R" % xref[ol["next"]]
14641464
except Exception:
14651465
# Verbose in PyMuPDF/tests.
1466-
if g_exceptions_verbose: pymupdf.exception_info()
1466+
if g_exceptions_verbose >= 2: pymupdf.exception_info()
14671467
pass
14681468
try:
14691469
if ol["parent"] > -1:
14701470
txt += "/Parent %i 0 R" % xref[ol["parent"]]
14711471
except Exception:
14721472
# Verbose in PyMuPDF/tests.
1473-
if g_exceptions_verbose: pymupdf.exception_info()
1473+
if g_exceptions_verbose >= 2: pymupdf.exception_info()
14741474
pass
14751475
try:
14761476
if ol["prev"] > -1:
14771477
txt += "/Prev %i 0 R" % xref[ol["prev"]]
14781478
except Exception:
14791479
# Verbose in PyMuPDF/tests.
1480-
if g_exceptions_verbose: pymupdf.exception_info()
1480+
if g_exceptions_verbose >= 2: pymupdf.exception_info()
14811481
pass
14821482
try:
14831483
txt += "/Title" + ol["title"]
14841484
except Exception:
14851485
# Verbose in PyMuPDF/tests.
1486-
if g_exceptions_verbose: pymupdf.exception_info()
1486+
if g_exceptions_verbose >= 2: pymupdf.exception_info()
14871487
pass
14881488

14891489
if ol.get("color") and len(ol["color"]) == 3:
@@ -4686,8 +4686,7 @@ def output_justify(start, line):
46864686
try:
46874687
line, tl = new_lines.pop(0)
46884688
except IndexError:
4689-
# Verbose in PyMuPDF/tests.
4690-
if g_exceptions_verbose: pymupdf.exception_info()
4689+
if g_exceptions_verbose >= 2: pymupdf.exception_info()
46914690
break
46924691

46934692
if right_to_left: # Arabic, Hebrew

0 commit comments

Comments
 (0)