mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
- 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.
This commit is contained in:
parent
b491e0521f
commit
2a413853f1
4 changed files with 3647 additions and 3626 deletions
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue