Skip to content

Commit 970f3b7

Browse files
[3.13] gh-124842: Fix test.support.import_helper.make_legacy_pyc() (GH-124843) (GH-124853)
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 <[email protected]>
1 parent 4a9a359 commit 970f3b7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/test/support/import_helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def make_legacy_pyc(source):
5858
:return: The file system path to the legacy pyc file.
5959
"""
6060
pyc_file = importlib.util.cache_from_source(source)
61-
up_one = os.path.dirname(os.path.abspath(source))
62-
legacy_pyc = os.path.join(up_one, source + 'c')
61+
assert source.endswith('.py')
62+
legacy_pyc = source + 'c'
6363
shutil.move(pyc_file, legacy_pyc)
6464
return legacy_pyc
6565

0 commit comments

Comments
 (0)