File tree 4 files changed +10
-2
lines changed
4 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -369,6 +369,10 @@ def test_truncated_jpeg_throws_IOError(self):
369
369
with self .assertRaises (IOError ):
370
370
im .load ()
371
371
372
+ # Test that the error is raised if loaded a second time
373
+ with self .assertRaises (IOError ):
374
+ im .load ()
375
+
372
376
def _n_qtables_helper (self , n , test_file ):
373
377
im = Image .open (test_file )
374
378
f = self .tempfile ("temp.jpg" )
Original file line number Diff line number Diff line change @@ -111,6 +111,10 @@ def test_truncated_with_errors(self):
111
111
with self .assertRaises (IOError ):
112
112
im .load ()
113
113
114
+ # Test that the error is raised if loaded a second time
115
+ with self .assertRaises (IOError ):
116
+ im .load ()
117
+
114
118
def test_truncated_without_errors (self ):
115
119
if "zip_encoder" not in codecs :
116
120
self .skipTest ("PNG (zlib) encoder not available" )
Original file line number Diff line number Diff line change @@ -244,7 +244,6 @@ def load(self):
244
244
if LOAD_TRUNCATED_IMAGES :
245
245
break
246
246
else :
247
- self .tile = []
248
247
raise IOError (
249
248
"image file is truncated "
250
249
"(%d bytes not processed)" % len (b )
Original file line number Diff line number Diff line change @@ -612,7 +612,7 @@ def _open(self):
612
612
rawmode , data = self .png .im_palette
613
613
self .palette = ImagePalette .raw (rawmode , data )
614
614
615
- self .__idat = length # used by load_read ()
615
+ self .__prepare_idat = length # used by load_prepare ()
616
616
617
617
@property
618
618
def text (self ):
@@ -645,6 +645,7 @@ def load_prepare(self):
645
645
if self .info .get ("interlace" ):
646
646
self .decoderconfig = self .decoderconfig + (1 ,)
647
647
648
+ self .__idat = self .__prepare_idat # used by load_read()
648
649
ImageFile .ImageFile .load_prepare (self )
649
650
650
651
def load_read (self , read_bytes ):
You can’t perform that action at this time.
0 commit comments