mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Merge pull request #5250 from Piolie/open_formats_case
Changed Image.open formats parameter to be case-insensitive
This commit is contained in:
		
						commit
						bc0c0cb11a
					
				| 
						 | 
					@ -94,7 +94,7 @@ class TestImage:
 | 
				
			||||||
        with pytest.raises(TypeError):
 | 
					        with pytest.raises(TypeError):
 | 
				
			||||||
            Image.open(PNGFILE, formats=123)
 | 
					            Image.open(PNGFILE, formats=123)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for formats in [["JPEG"], ("JPEG",)]:
 | 
					        for formats in [["JPEG"], ("JPEG",), ["jpeg"], ["Jpeg"], ["jPeG"], ["JpEg"]]:
 | 
				
			||||||
            with pytest.raises(UnidentifiedImageError):
 | 
					            with pytest.raises(UnidentifiedImageError):
 | 
				
			||||||
                Image.open(PNGFILE, formats=formats)
 | 
					                Image.open(PNGFILE, formats=formats)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2922,6 +2922,7 @@ def open(fp, mode="r", formats=None):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _open_core(fp, filename, prefix, formats):
 | 
					    def _open_core(fp, filename, prefix, formats):
 | 
				
			||||||
        for i in formats:
 | 
					        for i in formats:
 | 
				
			||||||
 | 
					            i = i.upper()
 | 
				
			||||||
            if i not in OPEN:
 | 
					            if i not in OPEN:
 | 
				
			||||||
                init()
 | 
					                init()
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user