mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Clear pyaccess after re-assigning im
This commit is contained in:
		
							parent
							
								
									edcfe09f12
								
							
						
					
					
						commit
						b0f1d2ed8d
					
				| 
						 | 
					@ -71,6 +71,19 @@ def test_save_to_bytes():
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_getpixel(tmp_path):
 | 
				
			||||||
 | 
					    temp_file = str(tmp_path / "temp.ico")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    im = hopper()
 | 
				
			||||||
 | 
					    im.save(temp_file, "ico", sizes=[(32, 32), (64, 64)])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    with Image.open(temp_file) as reloaded:
 | 
				
			||||||
 | 
					        reloaded.load()
 | 
				
			||||||
 | 
					        reloaded.size = (32, 32)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assert reloaded.getpixel((0, 0)) == (18, 20, 62)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_no_duplicates(tmp_path):
 | 
					def test_no_duplicates(tmp_path):
 | 
				
			||||||
    temp_file = str(tmp_path / "temp.ico")
 | 
					    temp_file = str(tmp_path / "temp.ico")
 | 
				
			||||||
    temp_file2 = str(tmp_path / "temp2.ico")
 | 
					    temp_file2 = str(tmp_path / "temp2.ico")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -327,6 +327,7 @@ class IcoImageFile(ImageFile.ImageFile):
 | 
				
			||||||
        # if tile is PNG, it won't really be loaded yet
 | 
					        # if tile is PNG, it won't really be loaded yet
 | 
				
			||||||
        im.load()
 | 
					        im.load()
 | 
				
			||||||
        self.im = im.im
 | 
					        self.im = im.im
 | 
				
			||||||
 | 
					        self.pyaccess = None
 | 
				
			||||||
        self.mode = im.mode
 | 
					        self.mode = im.mode
 | 
				
			||||||
        if im.size != self.size:
 | 
					        if im.size != self.size:
 | 
				
			||||||
            warnings.warn("Image was not the expected size")
 | 
					            warnings.warn("Image was not the expected size")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user