Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f6901c8

Browse files
committed
Issue #19410: Put back in special-casing of '' for
importlib.machinery.FileFinder. While originally moved to stop special-casing '' as PathFinder farther up the typical call chain now uses the cwd in the instance of '', it was deemed an unnecessary risk to breaking subclasses of FileFinder to take the special-casing out.
1 parent 2be28a6 commit f6901c8

5 files changed

Lines changed: 797 additions & 800 deletions

File tree

Doc/library/importlib.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -753,9 +753,6 @@ find and load modules.
753753

754754
.. versionadded:: 3.3
755755

756-
.. versionchanged:: 3.4
757-
The empty string is no longer special-cased to be changed into ``'.'``.
758-
759756
.. attribute:: path
760757

761758
The path the finder will search in.

Doc/whatsnew/3.4.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,3 @@ that may require changes to your code.
812812
working directory will also now have an absolute path, including when using
813813
``-m`` with the interpreter (this does not influence when the path to a file
814814
is specified on the command-line).
815-
816-
* :class:`importlib.machinery.FileFinder` no longer special-cases the empty string
817-
to be changed to ``'.'``.

Lib/importlib/_bootstrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@ def __init__(self, path, *loader_details):
13751375
loaders.extend((suffix, loader) for suffix in suffixes)
13761376
self._loaders = loaders
13771377
# Base (directory) path
1378-
self.path = path
1378+
self.path = path or '.'
13791379
self._path_mtime = -1
13801380
self._path_cache = set()
13811381
self._relaxed_path_cache = set()

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Core and Builtins
3131
Library
3232
-------
3333

34+
- Issue #19410: Undo the special-casing removal of '' for
35+
importlib.machinery.FileFinder.
36+
3437
- Issue #19424: Fix the warnings module to accept filename containing surrogate
3538
characters.
3639

0 commit comments

Comments
 (0)