Skip to content

Commit

Permalink
pythongh-124842: Fix test.support.import_helper.make_legacy_pyc() (py…
Browse files Browse the repository at this point in the history
…thonGH-124843)

For source file "path/to/file.py" it created file with incorrect path
"/absolute/path/to/path/to/file.pyc" instead of "path/to/file.pyc".
(cherry picked from commit 60ff67d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
  • Loading branch information
serhiy-storchaka authored and miss-islington committed Oct 1, 2024
1 parent 9547d2a commit 3489087
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/test/support/import_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def make_legacy_pyc(source):
:return: The file system path to the legacy pyc file.
"""
pyc_file = importlib.util.cache_from_source(source)
up_one = os.path.dirname(os.path.abspath(source))
legacy_pyc = os.path.join(up_one, source + 'c')
assert source.endswith('.py')
legacy_pyc = source + 'c'
shutil.move(pyc_file, legacy_pyc)
return legacy_pyc

Expand Down

0 comments on commit 3489087

Please sign in to comment.