@@ -153,6 +153,10 @@ ABC hierarchy::
153153 module. Originally specified in :pep: `302 `, this method was meant
154154 for use in :data: `sys.meta_path ` and in the path-based import subsystem.
155155
156+ .. versionchanged :: 3.4
157+ Returns ``None `` when called instead of raising
158+ :exc: `NotImplementedError `.
159+
156160
157161.. class :: MetaPathFinder
158162
@@ -169,20 +173,27 @@ ABC hierarchy::
169173 will be the value of :attr: `__path__ ` from the parent
170174 package. If a loader cannot be found, ``None `` is returned.
171175
176+ .. versionchanged :: 3.4
177+ Returns ``None `` when called instead of raising
178+ :exc: `NotImplementedError `.
179+
172180 .. method :: invalidate_caches()
173181
174182 An optional method which, when called, should invalidate any internal
175183 cache used by the finder. Used by :func: `importlib.invalidate_caches `
176184 when invalidating the caches of all finders on :data: `sys.meta_path `.
177185
186+ .. versionchanged :: 3.4
187+ Returns ``None `` when called instead of ``NotImplemented ``.
188+
178189
179190.. class :: PathEntryFinder
180191
181192 An abstract base class representing a :term: `path entry finder `. Though
182193 it bears some similarities to :class: `MetaPathFinder `, ``PathEntryFinder ``
183194 is meant for use only within the path-based import subsystem provided
184195 by :class: `PathFinder `. This ABC is a subclass of :class: `Finder ` for
185- compatibility.
196+ compatibility reasons only .
186197
187198 .. versionadded :: 3.3
188199
@@ -194,9 +205,12 @@ ABC hierarchy::
194205 package. The loader may be ``None `` while specifying ``portion `` to
195206 signify the contribution of the file system locations to a namespace
196207 package. An empty list can be used for ``portion `` to signify the loader
197- is not part of a package. If ``loader `` is ``None `` and ``portion `` is
198- the empty list then no loader or location for a namespace package were
199- found (i.e. failure to find anything for the module).
208+ is not part of a namespace package. If ``loader `` is ``None `` and
209+ ``portion `` is the empty list then no loader or location for a namespace
210+ package were found (i.e. failure to find anything for the module).
211+
212+ .. versionchanged :: 3.4
213+ Returns ``(None, []) `` instead of raising :exc: `NotImplementedError `.
200214
201215 .. method :: find_module(fullname):
202216
@@ -249,21 +263,29 @@ ABC hierarchy::
249263 - :attr: `__package__ `
250264 The parent package for the module/package. If the module is
251265 top-level then it has a value of the empty string. The
252- :func: `importlib.util.set_package ` decorator can handle the details
253- for :attr: `__package__ `.
266+ :func: `importlib.util.module_for_loader ` decorator can handle the
267+ details for :attr: `__package__ `.
254268
255269 - :attr: `__loader__ `
256- The loader used to load the module.
257- (This is not set by the built-in import machinery,
258- but it should be set whenever a :term: `loader ` is used.)
270+ The loader used to load the module. The
271+ :func: `importlib.util.module_for_loader ` decorator can handle the
272+ details for :attr: `__package__ `.
273+
274+ .. versionchanged :: 3.4
275+ Raise :exc: `ImportError ` when called instead of
276+ :exc: `NotImplementedError `.
259277
260278 .. method :: module_repr(module)
261279
262- An abstract method which when implemented calculates and returns the
263- given module's repr, as a string.
280+ An optional method which when implemented calculates and returns the
281+ given module's repr, as a string. The module type's default repr() will
282+ use the result of this method as appropriate.
264283
265284 .. versionadded: 3.3
266285
286+ .. versionchanged :: 3.4
287+ Made optional instead of an abstractmethod.
288+
267289
268290.. class :: ResourceLoader
269291
@@ -281,6 +303,9 @@ ABC hierarchy::
281303 be found. The *path * is expected to be constructed using a module's
282304 :attr: `__file__ ` attribute or an item from a package's :attr: `__path__ `.
283305
306+ .. versionchanged :: 3.4
307+ Raises :exc: `IOError ` instead of :exc: `NotImplementedError `.
308+
284309
285310.. class :: InspectLoader
286311
@@ -297,6 +322,9 @@ ABC hierarchy::
297322 .. index ::
298323 single: universal newlines; importlib.abc.InspectLoader.get_source method
299324
325+ .. versionchanged :: 3.4
326+ Raises :exc: `ImportError ` instead of :exc: `NotImplementedError `.
327+
300328 .. method :: get_source(fullname)
301329
302330 An abstract method to return the source of a module. It is returned as
@@ -305,12 +333,18 @@ ABC hierarchy::
305333 if no source is available (e.g. a built-in module). Raises
306334 :exc: `ImportError ` if the loader cannot find the module specified.
307335
336+ .. versionchanged :: 3.4
337+ Raises :exc: `ImportError ` instead of :exc: `NotImplementedError `.
338+
308339 .. method :: is_package(fullname)
309340
310341 An abstract method to return a true value if the module is a package, a
311342 false value otherwise. :exc: `ImportError ` is raised if the
312343 :term: `loader ` cannot find the module.
313344
345+ .. versionchanged :: 3.4
346+ Raises :exc: `ImportError ` instead of :exc: `NotImplementedError `.
347+
314348
315349.. class :: ExecutionLoader
316350
@@ -328,6 +362,9 @@ ABC hierarchy::
328362 the source file, regardless of whether a bytecode was used to load the
329363 module.
330364
365+ .. versionchanged :: 3.4
366+ Raises :exc: `ImportError ` instead of :exc: `NotImplementedError `.
367+
331368
332369.. class :: FileLoader(fullname, path)
333370
@@ -392,10 +429,13 @@ ABC hierarchy::
392429 - ``'size' `` (optional): the size in bytes of the source code.
393430
394431 Any other keys in the dictionary are ignored, to allow for future
395- extensions.
432+ extensions. If the path cannot be handled, :exc: ` IOError ` is raised.
396433
397434 .. versionadded :: 3.3
398435
436+ .. versionchanged :: 3.4
437+ Raise :exc: `IOError ` instead of :exc: `NotImplementedError `.
438+
399439 .. method :: path_mtime(path)
400440
401441 Optional abstract method which returns the modification time for the
@@ -404,7 +444,10 @@ ABC hierarchy::
404444 .. deprecated :: 3.3
405445 This method is deprecated in favour of :meth: `path_stats `. You don't
406446 have to implement it, but it is still available for compatibility
407- purposes.
447+ purposes. Raise :exc: `IOError ` if the path cannot be handled.
448+
449+ .. versionchanged :: 3.4
450+ Raise :exc: `IOError ` instead of :exc: `NotImplementedError `.
408451
409452 .. method :: set_data(path, data)
410453
@@ -415,6 +458,9 @@ ABC hierarchy::
415458 When writing to the path fails because the path is read-only
416459 (:attr: `errno.EACCES `), do not propagate the exception.
417460
461+ .. versionchanged :: 3.4
462+ No longer raises :exc: `NotImplementedError ` when called.
463+
418464 .. method :: source_to_code(data, path)
419465
420466 Create a code object from Python source.
0 commit comments