Skip to content

STY: Return None from remove_objects_from_page - #3985

Merged
stefan6419846 merged 1 commit into
py-pdf:mainfrom
RavSinghChandan:fix-remove-objects-return
Aug 20, 2026
Merged

stefan6419846 merged 1 commit into
py-pdf:mainfrom
RavSinghChandan:fix-remove-objects-return

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

remove_objects_from_page is declared -> None and documented as returning
nothing, but its last line is:

return [], []  # type: ignore[return-value]

The tuple is never used. All four internal callers discard it, so do the tests,
and every other exit from the function either returns None or delegates to
_remove_annots_from_page, which is itself -> None. A runtime protocol check
rejects it because the value does not match the signature.

Returns None instead, and the ignore goes with it. return None rather than a
bare return to satisfy RET502, matching the early return higher up in the
same function.

Under make testtype this is 6 failures in test_writer; they go to 0. mypy
reports the same 11 pre-existing errors before and after, and ruff check passes.

`remove_objects_from_page` is declared `-> None` and documented as
returning nothing, but its last line is:

    return [], []  # type: ignore[return-value]

The tuple is never used. All four internal callers discard it, as do the
tests, and every other exit from the function returns None or delegates
to `_remove_annots_from_page`, which is itself `-> None`. A runtime
protocol check rejects it, since the value does not match the signature.

Return None instead and drop the ignore.
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.95%. Comparing base (b45aeba) to head (99a390a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3985   +/-   ##
=======================================
  Coverage   97.95%   97.95%           
=======================================
  Files          57       57           
  Lines       11043    11043           
  Branches     2068     2068           
=======================================
  Hits        10817    10817           
  Misses        126      126           
  Partials      100      100           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stefan6419846 stefan6419846 changed the title BUG: Return None from remove_objects_from_page STY: Return None from remove_objects_from_page Aug 20, 2026
@stefan6419846
stefan6419846 merged commit ae37f1d into py-pdf:main Aug 20, 2026
30 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants