mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Merge pull request #4103 from radarhere/dimension
Raise error if TIFF dimension is a string
This commit is contained in:
		
						commit
						b9693a51c9
					
				
							
								
								
									
										
											BIN
										
									
								
								Tests/images/string_dimension.tiff
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Tests/images/string_dimension.tiff
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -587,6 +587,11 @@ class TestFileTiff(PillowTestCase):
 | 
				
			||||||
            im.load()
 | 
					            im.load()
 | 
				
			||||||
            self.assertFalse(fp.closed)
 | 
					            self.assertFalse(fp.closed)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_string_dimension(self):
 | 
				
			||||||
 | 
					        # Assert that an error is raised if one of the dimensions is a string
 | 
				
			||||||
 | 
					        with self.assertRaises(ValueError):
 | 
				
			||||||
 | 
					            Image.open("Tests/images/string_dimension.tiff")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@unittest.skipUnless(sys.platform.startswith("win32"), "Windows only")
 | 
					@unittest.skipUnless(sys.platform.startswith("win32"), "Windows only")
 | 
				
			||||||
class TestFileTiffW32(PillowTestCase):
 | 
					class TestFileTiffW32(PillowTestCase):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1239,8 +1239,8 @@ class TiffImageFile(ImageFile.ImageFile):
 | 
				
			||||||
            print("- YCbCr subsampling:", self.tag.get(530))
 | 
					            print("- YCbCr subsampling:", self.tag.get(530))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # size
 | 
					        # size
 | 
				
			||||||
        xsize = self.tag_v2.get(IMAGEWIDTH)
 | 
					        xsize = int(self.tag_v2.get(IMAGEWIDTH))
 | 
				
			||||||
        ysize = self.tag_v2.get(IMAGELENGTH)
 | 
					        ysize = int(self.tag_v2.get(IMAGELENGTH))
 | 
				
			||||||
        self._size = xsize, ysize
 | 
					        self._size = xsize, ysize
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if DEBUG:
 | 
					        if DEBUG:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user