bpo-40334: Make the PyPegen* and PyParser* APIs more consistent by lysnikolaou · Pull Request #19839 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 28 additions & 19 deletions Include/internal/pegen_interface.h
4 changes: 2 additions & 2 deletions Modules/_peg_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ _Py_parse_file(PyObject *self, PyObject *args, PyObject *kwds)
PyCompilerFlags flags = _PyCompilerFlags_INIT;
PyObject *result = NULL;

mod_ty res = PyPegen_ASTFromFile(filename, mode, &flags, arena);
mod_ty res = PyPegen_ASTFromFilename(filename, mode, &flags, arena);
if (res == NULL) {
goto error;
}
Expand Down Expand Up @@ -84,7 +84,7 @@ _Py_parse_string(PyObject *self, PyObject *args, PyObject *kwds)
res = PyParser_ASTFromString(the_string, "<string>", mode, &flags, arena);
}
else {
res = PyPegen_ASTFromString(the_string, mode, &flags, arena);
res = PyPegen_ASTFromString(the_string, "<string>", mode, &flags, arena);
}
if (res == NULL) {
goto error;
Expand Down
91 changes: 6 additions & 85 deletions Parser/pegen/peg_api.c