summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-03-17 22:50:50 (GMT)
committerGitHub <noreply@github.com>2021-03-17 22:50:50 (GMT)
commit526fdeb2278b61653df704d7cfcaedde504dee48 (patch)
tree8c17493b7a55c2af626acdd2134920d8ca0a6757 /Include
parentb4536e1c6abe4c6219177a89e16575d05ea22f64 (diff)
downloadcpython-526fdeb2278b61653df704d7cfcaedde504dee48.zip
cpython-526fdeb2278b61653df704d7cfcaedde504dee48.tar.gz
cpython-526fdeb2278b61653df704d7cfcaedde504dee48.tar.bz2
bpo-43244: Add pycore_ast.h header file (GH-24908)
Move _PyAST_GetDocString() and _PyAST_ExprAsUnicode() functions the internal C API: from Include/ast.h to a new Include/internal/pycore_ast.h header file. Don't export these functions anymore: replace PyAPI_FUNC() with extern. Remove also unused includes.
Diffstat (limited to 'Include')
-rw-r--r--Include/ast.h8
-rw-r--r--Include/internal/pycore_ast.h25
2 files changed, 25 insertions, 8 deletions
diff --git a/Include/ast.h b/Include/ast.h
index 434ee18..2f19b1a 100644
--- a/Include/ast.h
+++ b/Include/ast.h
@@ -9,14 +9,6 @@ extern "C" {
PyAPI_FUNC(int) PyAST_Validate(mod_ty);
-/* _PyAST_ExprAsUnicode is defined in ast_unparse.c */
-PyAPI_FUNC(PyObject *) _PyAST_ExprAsUnicode(expr_ty);
-
-/* Return the borrowed reference to the first literal string in the
- sequence of statements or NULL if it doesn't start from a literal string.
- Doesn't set exception. */
-PyAPI_FUNC(PyObject *) _PyAST_GetDocString(asdl_stmt_seq *);
-
#ifdef __cplusplus
}
#endif
diff --git a/Include/internal/pycore_ast.h b/Include/internal/pycore_ast.h
new file mode 100644
index 0000000..38c9212
--- /dev/null
+++ b/Include/internal/pycore_ast.h
@@ -0,0 +1,25 @@
+#ifndef Py_INTERNAL_AST_H
+#define Py_INTERNAL_AST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+# error "this header requires Py_BUILD_CORE define"
+#endif
+
+#include "Python-ast.h" // expr_ty
+
+/* _PyAST_ExprAsUnicode is defined in ast_unparse.c */
+extern PyObject* _PyAST_ExprAsUnicode(expr_ty);
+
+/* Return the borrowed reference to the first literal string in the
+ sequence of statements or NULL if it doesn't start from a literal string.
+ Doesn't set exception. */
+extern PyObject* _PyAST_GetDocString(asdl_stmt_seq *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_AST_H */
+