Remove the PyAST_Validate() function. It is no longer possible to
build a AST object (mod_ty type) with the public C API. The function
was already excluded from the limited C API (PEP 384).
Rename PyAST_Validate() function to _PyAST_Validate(), move it to the
internal C API, and don't export it anymore (replace PyAPI_FUNC with
extern).
The function was added in bpo-12575 by
the commit
832bfe2ebd5ecfa92031cd40c8b41835ba90487f.
Python already implicitly installs signal handlers: see
:c:member:`PyConfig.install_signal_handlers`.
(Contributed by Victor Stinner in :issue:`41713`.)
+
+* Remove the ``PyAST_Validate()`` function. It is no longer possible to build a
+ AST object (``mod_ty`` type) with the public C API. The function was already
+ excluded from the limited C API (:pep:`384`).
+ (Contributed by Victor Stinner in :issue:`43244`.)
#include "Python-ast.h" /* mod_ty */
-PyAPI_FUNC(int) PyAST_Validate(mod_ty);
-
#ifdef __cplusplus
}
#endif
#include "Python-ast.h" // expr_ty
+extern int _PyAST_Validate(mod_ty);
+
/* _PyAST_ExprAsUnicode is defined in ast_unparse.c */
extern PyObject* _PyAST_ExprAsUnicode(expr_ty);
--- /dev/null
+Remove the ``PyAST_Validate()`` function. It is no longer possible to build a
+AST object (``mod_ty`` type) with the public C API. The function was already
+excluded from the limited C API (:pep:`384`). Patch by Victor Stinner.
#include <Python.h>
+#include "pycore_ast.h" // _PyAST_Validate()
#include <errcode.h>
#include "tokenizer.h"
p->start_rule == Py_file_input ||
p->start_rule == Py_eval_input)
{
- if (!PyAST_Validate(res)) {
+ if (!_PyAST_Validate(res)) {
return NULL;
}
}
}
int
-PyAST_Validate(mod_ty mod)
+_PyAST_Validate(mod_ty mod)
{
int res = 0;
#include <ctype.h>
#include "ast.h"
#undef Yield /* undefine macro conflicting with <winbase.h> */
+#include "pycore_ast.h" // _PyAST_Validate()
#include "pycore_object.h" // _Py_AddToAllObjects()
#include "pycore_pyerrors.h" // _PyErr_NoMemory()
#include "pycore_pystate.h" // _PyThreadState_GET()
PyArena_Free(arena);
goto error;
}
- if (!PyAST_Validate(mod)) {
+ if (!_PyAST_Validate(mod)) {
PyArena_Free(arena);
goto error;
}