swap conditions

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
Ondrej Baranovič 2024-01-08 17:17:17 +01:00 committed by GitHub
parent 0d841aab9a
commit f044d53fd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,7 +115,7 @@ class PpmImageFile(ImageFile.ImageFile):
for ix in range(3):
if mode == "F" and ix == 2:
scale = float(self._read_token())
if not math.isfinite(scale) or scale == 0.0:
if scale == 0.0 or not math.isfinite(scale):
msg = "scale must be finite and non-zero"
raise ValueError(msg)
rawmode = "F;32F" if scale < 0 else "F;32BF"