diff --git a/Tests/test_file_mpo.py b/Tests/test_file_mpo.py index 5402fcb440d..e0f42a26649 100644 --- a/Tests/test_file_mpo.py +++ b/Tests/test_file_mpo.py @@ -85,7 +85,9 @@ def test_exif(test_file: str) -> None: im_reloaded = roundtrip(im_original, save_all=True, exif=im_original.getexif()) for im in (im_original, im_reloaded): + assert isinstance(im, MpoImagePlugin.MpoImageFile) info = im._getexif() + assert info is not None assert info[272] == "Nintendo 3DS" assert info[296] == 2 assert info[34665] == 188 diff --git a/src/PIL/JpegImagePlugin.py b/src/PIL/JpegImagePlugin.py index af24faa5de2..d83d60b7b1b 100644 --- a/src/PIL/JpegImagePlugin.py +++ b/src/PIL/JpegImagePlugin.py @@ -468,7 +468,7 @@ def load_djpeg(self) -> None: self.tile = [] - def _getexif(self) -> dict[str, Any] | None: + def _getexif(self) -> dict[int, Any] | None: return _getexif(self) def _read_dpi_from_exif(self) -> None: @@ -504,7 +504,7 @@ def _getmp(self) -> dict[int, Any] | None: return _getmp(self) -def _getexif(self: JpegImageFile) -> dict[str, Any] | None: +def _getexif(self: JpegImageFile) -> dict[int, Any] | None: if "exif" not in self.info: return None return self.getexif()._get_merged_dict() diff --git a/src/PIL/PngImagePlugin.py b/src/PIL/PngImagePlugin.py index 247f908edaa..58db7777c39 100644 --- a/src/PIL/PngImagePlugin.py +++ b/src/PIL/PngImagePlugin.py @@ -1054,7 +1054,7 @@ def load_end(self) -> None: self._prev_im.paste(updated, self.dispose_extent, mask) self.im = self._prev_im - def _getexif(self) -> dict[str, Any] | None: + def _getexif(self) -> dict[int, Any] | None: if "exif" not in self.info: self.load() if "exif" not in self.info and "Raw profile type exif" not in self.info: diff --git a/src/PIL/WebPImagePlugin.py b/src/PIL/WebPImagePlugin.py index 011de9c6ac0..cec7963405b 100644 --- a/src/PIL/WebPImagePlugin.py +++ b/src/PIL/WebPImagePlugin.py @@ -96,7 +96,7 @@ def _open(self) -> None: # Initialize seek state self._reset(reset=False) - def _getexif(self) -> dict[str, Any] | None: + def _getexif(self) -> dict[int, Any] | None: if "exif" not in self.info: return None return self.getexif()._get_merged_dict()