summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-10-18 16:01:06 (GMT)
committerBrett Cannon <brett@python.org>2013-10-18 16:01:06 (GMT)
commitbb9e481efa1c18d112abe786a7e5bc22cf3c40e8 (patch)
tree217ee3ac6e3019614337a8eb3b6959f3cfbea81e /Lib/importlib
parentaf002e6482fbd6f6c6e87c69c72d3097578a29fe (diff)
downloadcpython-bb9e481efa1c18d112abe786a7e5bc22cf3c40e8.zip
cpython-bb9e481efa1c18d112abe786a7e5bc22cf3c40e8.tar.gz
cpython-bb9e481efa1c18d112abe786a7e5bc22cf3c40e8.tar.bz2
Issue #18416: Fix various os calls in importlib.machinery.FileFinder
now that self.path is no longer forced to '.'.
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/_bootstrap.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index bc1ee05..842aecc 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1390,7 +1390,7 @@ class FileFinder:
is_namespace = False
tail_module = fullname.rpartition('.')[2]
try:
- mtime = _os.stat(self.path).st_mtime
+ mtime = _os.stat(self.path or _os.getcwd()).st_mtime
except OSError:
mtime = -1
if mtime != self._path_mtime:
@@ -1432,7 +1432,7 @@ class FileFinder:
"""Fill the cache of potential modules and packages for this directory."""
path = self.path
try:
- contents = _os.listdir(path)
+ contents = _os.listdir(path or _os.getcwd())
except (FileNotFoundError, PermissionError, NotADirectoryError):
# Directory has either been removed, turned into a file, or made
# unreadable.