1313except ImportError as exc :
1414 _frozen_importlib_external = _bootstrap_external
1515import abc
16+ import warnings
1617
1718
1819def _register (abstract_cls , * classes ):
@@ -34,6 +35,8 @@ class Finder(metaclass=abc.ABCMeta):
3435 reimplementations of the import system. Otherwise, finder
3536 implementations should derive from the more specific MetaPathFinder
3637 or PathEntryFinder ABCs.
38+
39+ Deprecated since Python 3.3
3740 """
3841
3942 @abc .abstractmethod
@@ -57,11 +60,16 @@ def find_module(self, fullname, path):
5760 If no module is found, return None. The fullname is a str and
5861 the path is a list of strings or None.
5962
60- This method is deprecated in favor of finder.find_spec(). If find_spec()
61- exists then backwards-compatible functionality is provided for this
62- method.
63+ This method is deprecated since Python 3.4 in favor of
64+ finder.find_spec(). If find_spec() exists then backwards-compatible
65+ functionality is provided for this method.
6366
6467 """
68+ warnings .warn ("MetaPathFinder.find_module() is deprecated since Python "
69+ "3.4 in favor of MetaPathFinder.find_spec()"
70+ "(available since 3.4)" ,
71+ DeprecationWarning ,
72+ stacklevel = 2 )
6573 if not hasattr (self , 'find_spec' ):
6674 return None
6775 found = self .find_spec (fullname , path )
@@ -94,10 +102,15 @@ def find_loader(self, fullname):
94102 The portion will be discarded if another path entry finder
95103 locates the module as a normal module or package.
96104
97- This method is deprecated in favor of finder.find_spec(). If find_spec()
98- is provided than backwards-compatible functionality is provided.
99-
105+ This method is deprecated since Python 3.4 in favor of
106+ finder.find_spec(). If find_spec() is provided than backwards-compatible
107+ functionality is provided.
100108 """
109+ warnings .warn ("PathEntryFinder.find_loader() is deprecated since Python "
110+ "3.4 in favor of PathEntryFinder.find_spec() "
111+ "(available since 3.4)" ,
112+ DeprecationWarning ,
113+ stacklevel = 2 )
101114 if not hasattr (self , 'find_spec' ):
102115 return None , []
103116 found = self .find_spec (fullname )
0 commit comments