summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/_bootstrap.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2014-12-01 22:52:43 (GMT)
committerBarry Warsaw <barry@python.org>2014-12-01 22:52:43 (GMT)
commitd32d4ae4ca94c0ec89b26a0798bdb33767e950ed (patch)
tree2cc9b9d89f0b0a98ab4604718940da83b0e6bde2 /Lib/importlib/_bootstrap.py
parent95df265e3a7a0713fcd8744e7a67ee8b29a17333 (diff)
parent9e4db75426be7433af7c0d5b569fb3f3c4b5877e (diff)
downloadcpython-d32d4ae4ca94c0ec89b26a0798bdb33767e950ed.zip
cpython-d32d4ae4ca94c0ec89b26a0798bdb33767e950ed.tar.gz
cpython-d32d4ae4ca94c0ec89b26a0798bdb33767e950ed.tar.bz2
- Issue #22966: Fix __pycache__ pyc file name clobber when pyc_compile is
asked to compile a source file containing multiple dots in the source file name.
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-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 64aea61..e694521 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -454,11 +454,11 @@ def cache_from_source(path, debug_override=None):
else:
suffixes = OPTIMIZED_BYTECODE_SUFFIXES
head, tail = _path_split(path)
- base_filename, sep, _ = tail.partition('.')
+ base, sep, rest = tail.rpartition('.')
tag = sys.implementation.cache_tag
if tag is None:
raise NotImplementedError('sys.implementation.cache_tag is None')
- filename = ''.join([base_filename, sep, tag, suffixes[0]])
+ filename = ''.join([(base if base else rest), sep, tag, suffixes[0]])
return _path_join(head, _PYCACHE, filename)