From 1aed4ff2a519845496010d9717ddd2edee0b4e58 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 11 Sep 2024 15:51:21 +0200 Subject: [PATCH] Catch a MemoryError in cairo This should close #202 --- libmat2/pdf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmat2/pdf.py b/libmat2/pdf.py index ca94067..2da21b5 100644 --- a/libmat2/pdf.py +++ b/libmat2/pdf.py @@ -38,7 +38,7 @@ class PDFParser(abstract.AbstractParser): if self.lightweight_cleaning is True: try: return self.__remove_all_lightweight() - except cairo.Error as e: + except (cairo.Error, MemoryError) as e: raise RuntimeError(e) return self.__remove_all_thorough()