mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-30 23:47:27 +03:00 
			
		
		
		
	Raise DeprecationWarning on raise_ioerror
This commit is contained in:
		
							parent
							
								
									dda6145fce
								
							
						
					
					
						commit
						7bb51a4aca
					
				|  | @ -93,6 +93,11 @@ class TestImageFile: | |||
| 
 | ||||
|         assert_image_equal(im1, im2) | ||||
| 
 | ||||
|     def test_raise_ioerror(self): | ||||
|         with pytest.raises(IOError): | ||||
|             with pytest.raises(DeprecationWarning): | ||||
|                 ImageFile.raise_ioerror(1) | ||||
| 
 | ||||
|     def test_raise_oserror(self): | ||||
|         with pytest.raises(OSError): | ||||
|             ImageFile.raise_oserror(1) | ||||
|  |  | |||
|  | @ -30,6 +30,7 @@ | |||
| import io | ||||
| import struct | ||||
| import sys | ||||
| import warnings | ||||
| 
 | ||||
| from . import Image | ||||
| from ._util import isPath | ||||
|  | @ -64,6 +65,15 @@ def raise_oserror(error): | |||
|     raise OSError(message + " when reading image file") | ||||
| 
 | ||||
| 
 | ||||
| def raise_ioerror(error): | ||||
|     warnings.warn( | ||||
|         "raise_ioerror is deprecated and will be removed in a future release. " | ||||
|         "Use raise_oserror instead.", | ||||
|         DeprecationWarning, | ||||
|     ) | ||||
|     return raise_oserror(error) | ||||
| 
 | ||||
| 
 | ||||
| def _tilesort(t): | ||||
|     # sort on offset | ||||
|     return t[2] | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user