[Python-checkins] cpython: Issue #19410: Put back in special-casing of '' for

brett.cannon python-checkins at python.org
Fri Nov 1 15:38:05 CET 2013


http://hg.python.org/cpython/rev/17d730d37b2f
changeset:   86823:17d730d37b2f
user:        Brett Cannon <brett at python.org>
date:        Fri Nov 01 10:37:57 2013 -0400
summary:
  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.

files:
  Doc/library/importlib.rst   |     3 -
  Doc/whatsnew/3.4.rst        |     3 -
  Lib/importlib/_bootstrap.py |     2 +-
  Misc/NEWS                   |     3 +
  Python/importlib.h          |  1586 +++++++++++-----------
  5 files changed, 797 insertions(+), 800 deletions(-)


diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -753,9 +753,6 @@
 
    .. versionadded:: 3.3
 
-   .. versionchanged:: 3.4
-      The empty string is no longer special-cased to be changed into ``'.'``.
-
    .. attribute:: path
 
       The path the finder will search in.
diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -812,6 +812,3 @@
   working directory will also now have an absolute path, including when using
   ``-m`` with the interpreter (this does not influence when the path to a file
   is specified on the command-line).
-
-* :class:`importlib.machinery.FileFinder` no longer special-cases the empty string
-  to be changed to ``'.'``.
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1375,7 +1375,7 @@
             loaders.extend((suffix, loader) for suffix in suffixes)
         self._loaders = loaders
         # Base (directory) path
-        self.path = path
+        self.path = path or '.'
         self._path_mtime = -1
         self._path_cache = set()
         self._relaxed_path_cache = set()
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -31,6 +31,9 @@
 Library
 -------
 
+- Issue #19410: Undo the special-casing removal of '' for
+  importlib.machinery.FileFinder.
+
 - Issue #19424: Fix the warnings module to accept filename containing surrogate
   characters.
 
diff --git a/Python/importlib.h b/Python/importlib.h
--- a/Python/importlib.h
+++ b/Python/importlib.h
[stripped]

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list