summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2021-05-12 09:57:37 (GMT)
committerGitHub <noreply@github.com>2021-05-12 09:57:37 (GMT)
commit378211f7789c4edf7385ff619fa74d6615bef242 (patch)
treea76a159db841112e3cc2e3b32ddb939ec3f3cba9 /Lib/importlib
parent8a12f46dd8c780de84d78e6dd8350230e52e0c46 (diff)
downloadcpython-378211f7789c4edf7385ff619fa74d6615bef242.zip
cpython-378211f7789c4edf7385ff619fa74d6615bef242.tar.gz
cpython-378211f7789c4edf7385ff619fa74d6615bef242.tar.bz2
bpo-44070: No longer eagerly makes import filenames absolute, except for extension modules (GH-26025) (#26028)
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/_bootstrap_external.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
index a00f35c..509f99a 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -711,11 +711,6 @@ def spec_from_file_location(name, location=None, *, loader=None,
pass
else:
location = _os.fspath(location)
- if not _path_isabs(location):
- try:
- location = _path_join(_os.getcwd(), location)
- except OSError:
- pass
# If the location is on the filesystem, but doesn't actually exist,
# we could return None here, indicating that the location is not
@@ -1152,6 +1147,11 @@ class ExtensionFileLoader(FileLoader, _LoaderBasics):
def __init__(self, name, path):
self.name = name
+ if not _path_isabs(path):
+ try:
+ path = _path_join(_os.getcwd(), path)
+ except OSError:
+ pass
self.path = path
def __eq__(self, other):