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
2 changes: 2 additions & 0 deletions Include/Python-ast.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Include/asdl.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifndef Py_LIMITED_API
#ifndef Py_ASDL_H
#define Py_ASDL_H

Expand Down Expand Up @@ -44,3 +45,4 @@ asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena);
#endif

#endif /* !Py_ASDL_H */
#endif /* Py_LIMITED_API */
6 changes: 2 additions & 4 deletions Include/ast.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifndef Py_LIMITED_API
#ifndef Py_AST_H
#define Py_AST_H
#ifdef __cplusplus
Expand All @@ -19,8 +20,6 @@ PyAPI_FUNC(mod_ty) PyAST_FromNodeObject(
PyObject *filename,
PyArena *arena);

#ifndef Py_LIMITED_API

/* _PyAST_ExprAsUnicode is defined in ast_unparse.c */
PyAPI_FUNC(PyObject *) _PyAST_ExprAsUnicode(expr_ty);

Expand All @@ -29,9 +28,8 @@ PyAPI_FUNC(PyObject *) _PyAST_ExprAsUnicode(expr_ty);
Doesn't set exception. */
PyAPI_FUNC(PyObject *) _PyAST_GetDocString(asdl_seq *);

#endif /* !Py_LIMITED_API */

#ifdef __cplusplus
}
#endif
#endif /* !Py_AST_H */
#endif /* !Py_LIMITED_API */
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Exclude Python-ast.h, ast.h and asdl.h from the limited API.
2 changes: 2 additions & 0 deletions Parser/asdl_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,7 @@ def main(srcfile, dump_module=False):
f.write('extern "C" {\n')
f.write('#endif\n')
f.write('\n')
f.write('#ifndef Py_LIMITED_API\n')
f.write('#include "asdl.h"\n')
f.write('\n')
f.write('#undef Yield /* undefine macro conflicting with <winbase.h> */\n')
Expand All @@ -1276,6 +1277,7 @@ def main(srcfile, dump_module=False):
f.write("PyObject* PyAST_mod2obj(mod_ty t);\n")
f.write("mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);\n")
f.write("int PyAST_Check(PyObject* obj);\n")
f.write("#endif /* !Py_LIMITED_API */\n")
f.write('\n')
f.write('#ifdef __cplusplus\n')
f.write('}\n')
Expand Down