From 3d659389e7561c024b5ffb9edd810e94814fa63e Mon Sep 17 00:00:00 2001 From: Martin Thoma Date: Sat, 23 Apr 2022 10:57:54 +0200 Subject: [PATCH] ROB: Handle recursion error (#804) This doesn't solve the issue, but it might make it less severe. See #520 See #268 See https://github.com/virantha/pypdfocr/issues/59 https://github.com/sfneal/PyPDF3/commit/3558a69388b12bbf166d81b8a863b1d6c9843c62 Co-authored-by: danniesim --- PyPDF2/pdf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyPDF2/pdf.py b/PyPDF2/pdf.py index 2312b90d9..035eeb223 100644 --- a/PyPDF2/pdf.py +++ b/PyPDF2/pdf.py @@ -634,7 +634,7 @@ def _sweepIndirectReferences(self, externMap, data): newobj = self._sweepIndirectReferences(externMap, newobj) self._objects[idnum-1] = newobj return newobj_ido - except ValueError: + except (ValueError, RecursionError): # Unable to resolve the Object, returning NullObject instead. warnings.warn("Unable to resolve [{}: {}], returning NullObject instead".format( data.__class__.__name__, data