Skip to content

Commit 174c4bf

Browse files
authored
pythongh-102781: fix cwd dependence in cases generator (python#102782)
1 parent 65fb7c4 commit 174c4bf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Tools/cases_generator/generate_cases.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ def __init__(
122122
self.prefix = " " * indent
123123
self.emit_line_directives = emit_line_directives
124124
self.lineno = 1
125+
filename = os.path.relpath(self.stream.name, ROOT)
125126
# Make filename more user-friendly and less platform-specific
126-
filename = self.stream.name.replace("\\", "/")
127+
filename = filename.replace("\\", "/")
127128
if filename.startswith("./"):
128129
filename = filename[2:]
129130
if filename.endswith(".new"):
@@ -567,6 +568,7 @@ def parse_file(self, filename: str, instrs_idx: dict[str, int]) -> None:
567568
with open(filename) as file:
568569
src = file.read()
569570

571+
filename = os.path.relpath(filename, ROOT)
570572
# Make filename more user-friendly and less platform-specific
571573
filename = filename.replace("\\", "/")
572574
if filename.startswith("./"):

0 commit comments

Comments
 (0)