Skip to content

Commit e4fa234

Browse files
authored
Merge pull request #4563 from radarhere/faster_error
Throw image loading error faster
2 parents 49e49d3 + fe82257 commit e4fa234

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/PIL/ImageFile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ def verify(self):
150150
def load(self):
151151
"""Load image data based on tile list"""
152152

153-
pixel = Image.Image.load(self)
154-
155153
if self.tile is None:
156154
raise OSError("cannot load this image")
155+
156+
pixel = Image.Image.load(self)
157157
if not self.tile:
158158
return pixel
159159

src/PIL/TiffImagePlugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,10 +1094,10 @@ def _load_libtiff(self):
10941094
""" Overload method triggered when we detect a compressed tiff
10951095
Calls out to libtiff """
10961096

1097-
pixel = Image.Image.load(self)
1098-
10991097
if self.tile is None:
11001098
raise OSError("cannot load this image")
1099+
1100+
pixel = Image.Image.load(self)
11011101
if not self.tile:
11021102
return pixel
11031103

0 commit comments

Comments
 (0)