summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorLysandros Nikolaou <lisandrosnik@gmail.com>2020-05-01 17:30:51 (GMT)
committerGitHub <noreply@github.com>2020-05-01 17:30:51 (GMT)
commit03b7642265e65f198682f22648dbe6cf4fff9835 (patch)
tree9eb424f013229729e2eef40ec91de43f69983027 /Modules
parentd9d6eadf003605f4cdb55e38df2168dd1bc0dbd5 (diff)
downloadcpython-03b7642265e65f198682f22648dbe6cf4fff9835.zip
cpython-03b7642265e65f198682f22648dbe6cf4fff9835.tar.gz
cpython-03b7642265e65f198682f22648dbe6cf4fff9835.tar.bz2
bpo-40334: Make the PyPegen* and PyParser* APIs more consistent (GH-19839)
This commit makes both APIs more consistent by doing the following: - Remove the `PyPegen_CodeObjectFrom*` functions, which weren't used and will probably not be needed. Functions like `Py_CompileStringObject` can be used instead. - Include a `const char *filename` parameter in `PyPegen_ASTFromString`. - Rename `PyPegen_ASTFromFile` to `PyPegen_ASTFromFilename`, because its signature is not the same with `PyParser_ASTFromFile`.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_peg_parser.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_peg_parser.c b/Modules/_peg_parser.c
index 59b80f9..3b27b2c 100644
--- a/Modules/_peg_parser.c
+++ b/Modules/_peg_parser.c
@@ -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;
}
@@ -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;