summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-10-01 16:05:17 (GMT)
committerGitHub <noreply@github.com>2024-10-01 16:05:17 (GMT)
commit60ff67d010078eca15a74b1429caf779ac4f9c74 (patch)
tree84d0243dfd4a07b55348e4f7276c4def3e8273ba /Lib/test
parentda1e5526aee674bb33c17a498aa3781587b9850c (diff)
downloadcpython-60ff67d010078eca15a74b1429caf779ac4f9c74.zip
cpython-60ff67d010078eca15a74b1429caf779ac4f9c74.tar.gz
cpython-60ff67d010078eca15a74b1429caf779ac4f9c74.tar.bz2
gh-124842: Fix test.support.import_helper.make_legacy_pyc() (GH-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".
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/support/import_helper.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/support/import_helper.py b/Lib/test/support/import_helper.py
index edcd2b9..2b91bdc 100644
--- a/Lib/test/support/import_helper.py
+++ b/Lib/test/support/import_helper.py
@@ -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