mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	[3.13] gh-121279: Re-add prematurely removed import warnings to importlib.abc (#121281)
Fixup for 51724620e8
Fixes https://github.com/python/cpython/issues/121279
			
			
This commit is contained in:
		
							parent
							
								
									ee1db25bc0
								
							
						
					
					
						commit
						dacf4ffa79
					
				
					 3 changed files with 25 additions and 0 deletions
				
			
		|  | @ -13,6 +13,7 @@ | |||
|     _frozen_importlib_external = _bootstrap_external | ||||
| from ._abc import Loader | ||||
| import abc | ||||
| import warnings | ||||
| 
 | ||||
| from .resources import abc as _resources_abc | ||||
| 
 | ||||
|  |  | |||
|  | @ -913,5 +913,27 @@ def test_universal_newlines(self): | |||
|                          SourceOnlyLoaderMock=SPLIT_SOL) | ||||
| 
 | ||||
| 
 | ||||
| class DeprecatedAttrsTests: | ||||
| 
 | ||||
|     """Test the deprecated attributes can be accessed.""" | ||||
| 
 | ||||
|     def test_deprecated_attr_ResourceReader(self): | ||||
|         with self.assertWarns(DeprecationWarning): | ||||
|             self.abc.ResourceReader | ||||
| 
 | ||||
|     def test_deprecated_attr_Traversable(self): | ||||
|         with self.assertWarns(DeprecationWarning): | ||||
|             self.abc.Traversable | ||||
| 
 | ||||
|     def test_deprecated_attr_TraversableResources(self): | ||||
|         with self.assertWarns(DeprecationWarning): | ||||
|             self.abc.TraversableResources | ||||
| 
 | ||||
| 
 | ||||
| (Frozen_DeprecatedAttrsTests, | ||||
|  Source_DeprecatedAttrsTests | ||||
|  ) = test_util.test_both(DeprecatedAttrsTests, abc=abc) | ||||
| 
 | ||||
| 
 | ||||
| if __name__ == '__main__': | ||||
|     unittest.main() | ||||
|  |  | |||
|  | @ -0,0 +1,2 @@ | |||
| Avoid :exc:`NameError` for the :mod:`warnings` module when accessing the | ||||
| depracated atributes of the :mod:`importlib.abc` module. | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Miro Hrončok
						Miro Hrončok