summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-03-24 00:29:09 (GMT)
committerGitHub <noreply@github.com>2021-03-24 00:29:09 (GMT)
commit57364ce34e0492fbc8b0a6b8c882f384bb489457 (patch)
treed2679621c672fee40eb7e22ff79a8ea85830c3b3 /Python/pythonrun.c
parenta054f6b2b1d9f75edfb5ec2247bbf60f07491977 (diff)
downloadcpython-57364ce34e0492fbc8b0a6b8c882f384bb489457.zip
cpython-57364ce34e0492fbc8b0a6b8c882f384bb489457.tar.gz
cpython-57364ce34e0492fbc8b0a6b8c882f384bb489457.tar.bz2
bpo-43244: Remove parser_interface.h header file (GH-25001)
Remove parser functions using the "struct _mod" type, because the AST C API was removed: * PyParser_ASTFromFile() * PyParser_ASTFromFileObject() * PyParser_ASTFromFilename() * PyParser_ASTFromString() * PyParser_ASTFromStringObject() These functions were undocumented and excluded from the limited C API. Add pycore_parser.h internal header file. Rename functions: * PyParser_ASTFromFileObject() => _PyParser_ASTFromFile() * PyParser_ASTFromStringObject() => _PyParser_ASTFromString() These functions are no longer exported (replace PyAPI_FUNC() with extern). Remove also _PyPegen_run_parser_from_file() function. Update test_peg_generator to use _PyPegen_run_parser_from_file_pointer() instead.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index e16835b..79ff42b 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -16,6 +16,7 @@
#include "pycore_compile.h" // _PyAST_Compile()
#include "pycore_interp.h" // PyInterpreterState.importlib
#include "pycore_object.h" // _PyDebug_PrintTotalRefs()
+#include "pycore_parser.h" // _PyParser_ASTFromString()
#include "pycore_pyerrors.h" // _PyErr_Fetch
#include "pycore_pylifecycle.h" // _Py_UnhandledKeyboardInterrupt
#include "pycore_pystate.h" // _PyInterpreterState_GET()
@@ -254,8 +255,8 @@ PyRun_InteractiveOneObjectEx(FILE *fp, PyObject *filename,
return -1;
}
- mod = PyParser_ASTFromFileObject(fp, filename, enc, Py_single_input,
- ps1, ps2, flags, &errcode, arena);
+ mod = _PyParser_ASTFromFile(fp, filename, enc, Py_single_input,
+ ps1, ps2, flags, &errcode, arena);
Py_XDECREF(v);
Py_XDECREF(w);
@@ -1102,7 +1103,7 @@ PyRun_StringFlags(const char *str, int start, PyObject *globals,
if (arena == NULL)
return NULL;
- mod = PyParser_ASTFromStringObject(str, filename, start, flags, arena);
+ mod = _PyParser_ASTFromString(str, filename, start, flags, arena);
if (mod != NULL)
ret = run_mod(mod, filename, globals, locals, flags, arena);
@@ -1121,8 +1122,8 @@ pyrun_file(FILE *fp, PyObject *filename, int start, PyObject *globals,
}
mod_ty mod;
- mod = PyParser_ASTFromFileObject(fp, filename, NULL, start, NULL, NULL,
- flags, NULL, arena);
+ mod = _PyParser_ASTFromFile(fp, filename, NULL, start, NULL, NULL,
+ flags, NULL, arena);
if (closeit) {
fclose(fp);
@@ -1292,7 +1293,7 @@ Py_CompileStringObject(const char *str, PyObject *filename, int start,
if (arena == NULL)
return NULL;
- mod = PyParser_ASTFromStringObject(str, filename, start, flags, arena);
+ mod = _PyParser_ASTFromString(str, filename, start, flags, arena);
if (mod == NULL) {
PyArena_Free(arena);
return NULL;