Skip to content

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

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixes3.14bugs and security fixestestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions