diff --git a/pypdf/_page.py b/pypdf/_page.py index 8dda9cf10..f812dbbbf 100644 --- a/pypdf/_page.py +++ b/pypdf/_page.py @@ -1087,6 +1087,7 @@ def _merge_page( return self._merge_page_writer( page2, page2transformation, ctm, over, expand ) + return None except (AssertionError, AttributeError): pass @@ -1179,6 +1180,7 @@ def _merge_page( self.replace_contents(ContentStream(new_content_array, self.pdf)) self[NameObject(PG.RESOURCES)] = new_resources self[NameObject(PG.ANNOTS)] = new_annots + return None def _merge_page_writer( self, diff --git a/pypdf/_writer.py b/pypdf/_writer.py index 59ac40307..78eee8984 100644 --- a/pypdf/_writer.py +++ b/pypdf/_writer.py @@ -2240,6 +2240,7 @@ def clean_forms( clean(content, images, forms, text_filters) page.replace_contents(content) + return [], [] # type: ignore def remove_images( self, @@ -3213,6 +3214,7 @@ def find_outline_item( o = cast(TreeObject, o["/Next"]) else: return None + return None # This line may be unreachable? def find_bookmark( self, diff --git a/pyproject.toml b/pyproject.toml index a28f52dcf..10aa0472c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -179,7 +179,6 @@ ignore = [ "PT014", # Ruff bug: Duplicate of test case at index 1 in `@pytest_mark.parametrize` "PTH123", # `open()` should be replaced by `Path.open()` "PYI042", # Type alias `mode_str_type` should be CamelCase - "RET503", # Missing explicit `return` at the end of function able to return non-`None` value "RUF001", # Detect confusable Unicode-to-Unicode units. Introduces bugs "RUF002", # Detect confusable Unicode-to-Unicode units. Introduces bugs "S101", # Use of `assert` detected