Skip to content

Improve make regen-pegen DX on merge conflicts #133376

@sobolevn

Description

@sobolevn

Bug report

Right now if you have a merge conflict in parser.c - the easiest way is to delete this file, merge grammars and then run make regen-pegen to regen the parser. But, it does not work until you run touch Parser/parser.c, which is not really useful.

I propose to make this file by default, if it does not exist.

python3.13 ./Tools/build/update_file.py ./Parser/parser.c ./Parser/parser.c.new
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/./Tools/build/update_file.py", line 83, in <module>
    outcome = update_file_with_tmpfile(**kwargs)
  File "/Users/sobolev/Desktop/cpython/./Tools/build/update_file.py", line 51, in update_file_with_tmpfile
    targetfile = open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: './Parser/parser.c'
make: *** [regen-pegen] Error 1

@dura0ok said that he wants to work on it.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildtopic-parsertype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions