File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -692,6 +692,14 @@ class WindowsRegistryFinder:
692692 '\\ Modules\\ {fullname}\\ Debug' )
693693 DEBUG_BUILD = (_MS_WINDOWS and '_d.pyd' in EXTENSION_SUFFIXES )
694694
695+ def __init__ (self ):
696+ import warnings
697+ warnings .warn ("importlib.machinery.WindowsRegistryFinder is "
698+ "deprecated. Use site configuration instead. "
699+ "Future versions of Python may not enable this "
700+ "finder by default." ,
701+ DeprecationWarning , stacklevel = 2 )
702+
695703 @staticmethod
696704 def _open_registry (key ):
697705 try :
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ def all_suffixes():
3333
3434def __getattr__ (name ):
3535 import warnings
36+
3637 if name == 'DEBUG_BYTECODE_SUFFIXES' :
3738 warnings .warn ("importlib.machinery.DEBUG_BYTECODE_SUFFIXES is "
3839 "deprecated. Use importlib.machinery.BYTECODE_SUFFIXES "
Original file line number Diff line number Diff line change @@ -493,9 +493,14 @@ def test_util(self):
493493
494494
495495class TestDeprecations (unittest .TestCase ):
496- def test_machinery_deprecated_constants (self ):
496+ def test_machinery_deprecated_members (self ):
497497 from importlib import machinery
498- for attr in ('DEBUG_BYTECODE_SUFFIXES' , 'OPTIMIZED_BYTECODE_SUFFIXES' ):
498+ attributes = (
499+ 'DEBUG_BYTECODE_SUFFIXES' ,
500+ 'OPTIMIZED_BYTECODE_SUFFIXES' ,
501+ 'WindowsRegistryFinder' ,
502+ )
503+ for attr in attributes :
499504 with self .subTest (attr = attr ):
500505 with self .assertWarns (DeprecationWarning ):
501506 getattr (machinery , attr )
You can’t perform that action at this time.
0 commit comments