Skip to content

Temporarily ignore Pillow ImageFile context manager return type - #384

Merged
bgilbert merged 1 commit into
openslide:mainfrom
bgilbert:imagefile
Oct 20, 2026
Merged

bgilbert merged 1 commit into
openslide:mainfrom
bgilbert:imagefile

Conversation

@bgilbert

Copy link
Copy Markdown
Member

Pillow 13.0.0 changes the context manager to return typing.Self, which was added in Python 3.11, but we configure Mypy to assume Python 3.10+. This causes pre-commit to fail:

openslide/__init__.py:395: error: Returning Any from function declared to return "str | None"  [no-any-return]

Mypy should check 3.10+ syntax as long as we support 3.10, so re-add the ignore for now. Bump the Mypy Pillow dependency to ensure we don't have the opposite problem with old prek caches.

Pillow 13.0.0 changes the context manager to return typing.Self, which was
added in Python 3.11, but we configure Mypy to assume Python 3.10+.  This
causes pre-commit to fail:

    openslide/__init__.py:395: error: Returning Any from function declared to return "str | None"  [no-any-return]

Mypy should check 3.10+ syntax as long as we support 3.10, so re-add the
ignore for now.  Bump the Mypy Pillow dependency to ensure we don't have
the opposite problem with old prek caches.

Signed-off-by: Benjamin Gilbert <bgilbert@cs.cmu.edu>
@openslide-bot

Copy link
Copy Markdown
Member

DCO signed off ✔️

All commits have been signed off. You have certified to the terms of the Developer Certificate of Origin, version 1.1. In particular, you certify that this contribution has not been developed using information obtained under a non-disclosure agreement or other license terms that forbid you from contributing it under the GNU Lesser General Public License, version 2.1.

@bgilbert
bgilbert enabled auto-merge October 20, 2026 06:16
@bgilbert
bgilbert merged commit 442c7fb into openslide:main Oct 20, 2026
77 checks passed
@bgilbert
bgilbert deleted the imagefile branch October 20, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants