summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-07-06 22:04:41 (GMT)
committerBrett Cannon <brett@python.org>2013-07-06 22:04:41 (GMT)
commit7e5d55705c2694e941047c5d3aac280211f566ce (patch)
tree0357fad36c3cda49c3c93f8892b1f6bd8e6adf59 /Lib/importlib
parent98054b4c1be933f5bbfb3c1a1f4ee3f556dd47ca (diff)
parenta53cca3fea655e19a9b98d14c514dcc4c2f780fe (diff)
downloadcpython-7e5d55705c2694e941047c5d3aac280211f566ce.zip
cpython-7e5d55705c2694e941047c5d3aac280211f566ce.tar.gz
cpython-7e5d55705c2694e941047c5d3aac280211f566ce.tar.bz2
merge for issue #18351.
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/_bootstrap.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index 436d5b1..793619e 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -443,16 +443,14 @@ def _get_sourcefile(bytecode_path):
"""
if len(bytecode_path) == 0:
return None
- rest, _, extension = bytecode_path.rparition('.')
- if not rest or extension.lower()[-3:-1] != '.py':
+ rest, _, extension = bytecode_path.rpartition('.')
+ if not rest or extension.lower()[-3:-1] != 'py':
return bytecode_path
-
try:
source_path = source_from_cache(bytecode_path)
except (NotImplementedError, ValueError):
- source_path = bytcode_path[-1:]
-
- return source_path if _path_isfile(source_stats) else bytecode_path
+ source_path = bytecode_path[:-1]
+ return source_path if _path_isfile(source_path) else bytecode_path
def _calc_mode(path):