Skip to content

import_helper.make_legacy_pyc() works incorrectly for source files in a directory #124842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
serhiy-storchaka opened this issue Oct 1, 2024 · 1 comment
Labels
3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Oct 1, 2024

Bug report

For source file with relative path "path/to/file.py" it creates file with incorrect path "/absolute/path/to/path/to/file.pyc" instead of "path/to/file.pyc".

  • it adds the directory path to the source file twice.
  • it seems that returning an absolute path is unnecessary.

Surprisingly, the broken version works in all existing tests. Either they only use the source file path without directory, or absolute path, or the test is indifferent to the compiled file path. But it did not work in #124799 which created independent set of tests for running compiled files.

Linked PRs

@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir 3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes labels Oct 1, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Oct 1, 2024
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".
serhiy-storchaka added a commit that referenced this issue Oct 1, 2024
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".
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 1, 2024
…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>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 1, 2024
…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>
@serhiy-storchaka
Copy link
Member Author

And indeed, all existing calls to this function either used absolute path or a path without directory name.

serhiy-storchaka added a commit that referenced this issue Oct 1, 2024
…H-124843) (GH-124854)

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>
pablogsal pushed a commit to pablogsal/cpython that referenced this issue Oct 1, 2024
serhiy-storchaka added a commit that referenced this issue Oct 7, 2024
…H-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 <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant