summaryrefslogtreecommitdiffstats
path: root/Include
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 /Include
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 'Include')
-rw-r--r--Include/Python.h1
-rw-r--r--Include/cpython/parser_interface.h52
-rw-r--r--Include/internal/pycore_parser.h31
3 files changed, 31 insertions, 53 deletions
diff --git a/Include/Python.h b/Include/Python.h
index 86dbbcf..c87a7dd 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -141,7 +141,6 @@
#include "modsupport.h"
#include "compile.h"
#include "pythonrun.h"
-#include "cpython/parser_interface.h"
#include "pylifecycle.h"
#include "ceval.h"
#include "sysmodule.h"
diff --git a/Include/cpython/parser_interface.h b/Include/cpython/parser_interface.h
deleted file mode 100644
index 1c6576d..0000000
--- a/Include/cpython/parser_interface.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef Py_PEGENINTERFACE
-#define Py_PEGENINTERFACE
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "Python.h"
-
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(
- const char *str,
- const char *filename,
- int mode,
- PyCompilerFlags *flags,
- PyArena *arena);
-PyAPI_FUNC(struct _mod *) PyParser_ASTFromStringObject(
- const char *str,
- PyObject* filename,
- int mode,
- PyCompilerFlags *flags,
- PyArena *arena);
-PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(
- FILE *fp,
- const char *filename,
- const char* enc,
- int mode,
- const char *ps1,
- const char *ps2,
- PyCompilerFlags *flags,
- int *errcode,
- PyArena *arena);
-PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject(
- FILE *fp,
- PyObject *filename_ob,
- const char *enc,
- int mode,
- const char *ps1,
- const char *ps2,
- PyCompilerFlags *flags,
- int *errcode,
- PyArena *arena);
-PyAPI_FUNC(struct _mod *) PyParser_ASTFromFilename(
- const char *filename,
- int mode,
- PyCompilerFlags *flags,
- PyArena *arena);
-#endif /* !Py_LIMITED_API */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_PEGENINTERFACE */
diff --git a/Include/internal/pycore_parser.h b/Include/internal/pycore_parser.h
new file mode 100644
index 0000000..e2de24e
--- /dev/null
+++ b/Include/internal/pycore_parser.h
@@ -0,0 +1,31 @@
+#ifndef Py_INTERNAL_PARSER_H
+#define Py_INTERNAL_PARSER_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+# error "this header requires Py_BUILD_CORE define"
+#endif
+
+extern struct _mod* _PyParser_ASTFromString(
+ const char *str,
+ PyObject* filename,
+ int mode,
+ PyCompilerFlags *flags,
+ PyArena *arena);
+extern struct _mod* _PyParser_ASTFromFile(
+ FILE *fp,
+ PyObject *filename_ob,
+ const char *enc,
+ int mode,
+ const char *ps1,
+ const char *ps2,
+ PyCompilerFlags *flags,
+ int *errcode,
+ PyArena *arena);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_PARSER_H */