mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Initialise __frame = 0 in open, and test tell
This commit is contained in:
		
							parent
							
								
									1c2b2b085a
								
							
						
					
					
						commit
						2e9030ddca
					
				| 
						 | 
					@ -629,6 +629,10 @@ class TestFilePng:
 | 
				
			||||||
        with Image.open(test_file) as reloaded:
 | 
					        with Image.open(test_file) as reloaded:
 | 
				
			||||||
            assert reloaded.info["exif"] == b"Exif\x00\x00exifstring"
 | 
					            assert reloaded.info["exif"] == b"Exif\x00\x00exifstring"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_tell(self, tmp_path):
 | 
				
			||||||
 | 
					        with Image.open(TEST_PNG_FILE) as im:
 | 
				
			||||||
 | 
					            assert im.tell() == 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_seek(self, tmp_path):
 | 
					    def test_seek(self, tmp_path):
 | 
				
			||||||
        with Image.open(TEST_PNG_FILE) as im:
 | 
					        with Image.open(TEST_PNG_FILE) as im:
 | 
				
			||||||
            im.seek(0)
 | 
					            im.seek(0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -630,13 +630,13 @@ class PngImageFile(ImageFile.ImageFile):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    format = "PNG"
 | 
					    format = "PNG"
 | 
				
			||||||
    format_description = "Portable network graphics"
 | 
					    format_description = "Portable network graphics"
 | 
				
			||||||
    __frame = 0
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _open(self):
 | 
					    def _open(self):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if self.fp.read(8) != _MAGIC:
 | 
					        if self.fp.read(8) != _MAGIC:
 | 
				
			||||||
            raise SyntaxError("not a PNG file")
 | 
					            raise SyntaxError("not a PNG file")
 | 
				
			||||||
        self.__fp = self.fp
 | 
					        self.__fp = self.fp
 | 
				
			||||||
 | 
					        self.__frame = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        #
 | 
					        #
 | 
				
			||||||
        # Parse headers up to the first IDAT or fDAT chunk
 | 
					        # Parse headers up to the first IDAT or fDAT chunk
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user