Skip to content

Cases generator: inserted #line directives are dependent on cwd #102781

Closed
@carljm

Description

@carljm

Bug report

Python supports out-of-tree builds, e.g.:

> git clone git@github.com:python/cpython
> mkdir -p builds/dbg
> cd builds/dbg
> ../../cpython/configure --with-pydebug
> make -j

This is useful for e.g. keeping both debug and opt and asan builds around, without constantly having to make clean and recompile.

Currently the output of make regen-cases is cwd-dependent, so running it from an out-of-tree build (with no other changes) will change all #line directives in generated_cases.c.h from e.g. Python/bytecodes.c to e.g. ../../cpython/Python/bytecodes.c.

This is easily fixable by inserting a couple os.path.relpath(..., ROOT) calls in the cases generator, to ensure all the filenames used in #line directives are always relative to the repo root, regardless of cwd.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions