From b510e912ccc93b4c63bf83c8705d555034e5c05f Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 29 Dec 2025 09:49:53 +1100 Subject: [PATCH] Added return type to _close_fp() --- src/PIL/ImageFile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PIL/ImageFile.py b/src/PIL/ImageFile.py index a1d98bd5103..ecb51b193e8 100644 --- a/src/PIL/ImageFile.py +++ b/src/PIL/ImageFile.py @@ -131,6 +131,7 @@ def __init__( self.decoderconfig: tuple[Any, ...] = () self.decodermaxblock = MAXBLOCK + self._fp: IO[bytes] | DeferredError if is_path(fp): # filename self.fp = open(fp, "rb") @@ -167,7 +168,7 @@ def __init__( def _open(self) -> None: pass - def _close_fp(self): + def _close_fp(self) -> None: if getattr(self, "_fp", False) and not isinstance(self._fp, DeferredError): if self._fp != self.fp: self._fp.close()