Skip to content

Commit 7dca732

Browse files
authored
gh-125084: Resolve paths in generator common code (GH-125085)
In out of tree builds, the paths can contain `../ which needs to be resolved for the relative path calculation to work.
1 parent fca5529 commit 7dca732

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Tools/cases_generator/generators_common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ def peek(self) -> Token | None:
4343
break
4444
return self.look_ahead
4545

46-
ROOT = Path(__file__).parent.parent.parent
47-
DEFAULT_INPUT = (ROOT / "Python/bytecodes.c").absolute().as_posix()
46+
ROOT = Path(__file__).parent.parent.parent.resolve()
47+
DEFAULT_INPUT = (ROOT / "Python/bytecodes.c").as_posix()
4848

4949

5050
def root_relative_path(filename: str) -> str:
5151
try:
52-
return Path(filename).absolute().relative_to(ROOT).as_posix()
52+
return Path(filename).resolve().relative_to(ROOT).as_posix()
5353
except ValueError:
5454
# Not relative to root, just return original path.
5555
return filename

0 commit comments

Comments
 (0)