From cadac4aad2487e2d3c097d4ad0d71c31ce4f49fb Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 18 Oct 2022 19:50:33 +1100 Subject: [PATCH] Corrected error messages --- src/PIL/DdsImagePlugin.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/PIL/DdsImagePlugin.py b/src/PIL/DdsImagePlugin.py index ad86ff976..69bfb8f2a 100644 --- a/src/PIL/DdsImagePlugin.py +++ b/src/PIL/DdsImagePlugin.py @@ -319,7 +319,8 @@ class DdsImageFile(ImageFile.ImageFile): ) self.tile = [("raw", extents, 0, (rawmode[::-1], 0, 1))] else: - raise OSError(f"Unsupported bitcount {bitcount} for {pfflags}") + msg = f"Unsupported bitcount {bitcount} for {pfflags_}" + raise OSError(msg) elif pfflags & DDPF.LUMINANCE: if bitcount == 8: self.mode = "L" @@ -328,7 +329,8 @@ class DdsImageFile(ImageFile.ImageFile): self.mode = "LA" self.tile = [("raw", extents, 0, ("LA", 0, 1))] else: - raise OSError(f"Unsupported bitcount {bitcount} for {pfflags}") + msg = f"Unsupported bitcount {bitcount} for {pfflags_}" + raise OSError(msg) elif pfflags & DDPF.FOURCC: data_offs = header_size + 4 if fourcc == D3DFMT.DXT1: @@ -398,12 +400,12 @@ class DdsImageFile(ImageFile.ImageFile): msg = f"Unimplemented DXGI format {dxgi_format}" raise NotImplementedError(msg) else: - msg = f"Unimplemented pixel format {repr(fourcc)}" + msg = f"Unimplemented pixel format {repr(fourcc_)}" raise NotImplementedError(msg) self.tile = [tile] else: - msg = f"Unknown pixel format flags {repr(pfflags)}" + msg = f"Unknown pixel format flags {repr(pfflags_)}" raise NotImplementedError(msg) def load_seek(self, pos):