From 95d9e8d91a672c0097f4aeb6d6c789f6c0c79542 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sat, 28 Aug 2021 00:18:14 -0700 Subject: [PATCH] info: inconsistent types used in ContentsInfo.name_index This broke PyPy but CPython is fine with it. --- src/ocrmypdf/pdfinfo/info.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ocrmypdf/pdfinfo/info.py b/src/ocrmypdf/pdfinfo/info.py index 7264e80b..4aeecb3e 100644 --- a/src/ocrmypdf/pdfinfo/info.py +++ b/src/ocrmypdf/pdfinfo/info.py @@ -113,7 +113,7 @@ class ContentsInfo(NamedTuple): inline_images: List[InlineSettings] found_vector: bool found_text: bool - name_index: Mapping[Object, List[XobjectSettings]] + name_index: Mapping[str, List[XobjectSettings]] class TextboxInfo(NamedTuple): @@ -209,7 +209,7 @@ def _interpret_contents(contentstream: Object, initial_shorthand=UNIT_SQUARE): name=image_name, shorthand=ctm.shorthand, stack_depth=len(stack) ) xobject_settings.append(settings) - name_index[image_name].append(settings) + name_index[str(image_name)].append(settings) elif operator == 'INLINE IMAGE': # BI/ID/EI are grouped into this iimage = operands[0] inline = InlineSettings(