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()