diff options
| author | Barry Warsaw <barry@python.org> | 2014-12-01 22:23:55 (GMT) |
|---|---|---|
| committer | Barry Warsaw <barry@python.org> | 2014-12-01 22:23:55 (GMT) |
| commit | 9e4db75426be7433af7c0d5b569fb3f3c4b5877e (patch) | |
| tree | dd1466daccf2d5f11d530cfc4f194cd7eea1dce9 /Lib/importlib/_bootstrap.py | |
| parent | eecd5c4a007b6f5926063a6b9c695cd4c9d2b2ec (diff) | |
| parent | 2a413853f15755060996ba20ab7cdeedb7caff22 (diff) | |
| download | cpython-9e4db75426be7433af7c0d5b569fb3f3c4b5877e.zip cpython-9e4db75426be7433af7c0d5b569fb3f3c4b5877e.tar.gz cpython-9e4db75426be7433af7c0d5b569fb3f3c4b5877e.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.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index b8836c1..5b91c05 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -453,11 +453,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) |
