summaryrefslogtreecommitdiff
path: root/Python/ast.c
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2020-10-19 15:50:36 +0100
committerGitHub <noreply@github.com>2020-10-19 15:50:36 +0100
commitc82f10450c547eb94a04ee17b7c816ff31948297 (patch)
treead305c05c5745e1a5e7c136545bec7eefa741e32 /Python/ast.c
parenteee6bb50c69d94280f43b47390ea9d1b5f42930c (diff)
parentb580ed1d9d55461d8dde027411b90be26cae131e (diff)
downloadcpython-git-bpo-39107.tar.gz
Merge branch 'master' into bpo-39107bpo-39107
Diffstat (limited to 'Python/ast.c')
-rw-r--r--Python/ast.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 4b7bbd229c..5e74f65a2c 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -1,18 +1,12 @@
/*
- * This file includes functions to transform a concrete syntax tree (CST) to
- * an abstract syntax tree (AST). The main function is PyAST_FromNode().
- *
+ * This file exposes PyAST_Validate interface to check the integrity
+ * of the given abstract syntax tree (potentially constructed manually).
*/
#include "Python.h"
#include "Python-ast.h"
#include "ast.h"
-#include "token.h"
-#include "pythonrun.h"
#include <assert.h>
-#include <stdbool.h>
-
-#define MAXLEVEL 200 /* Max parentheses level */
static int validate_stmts(asdl_stmt_seq *);
static int validate_exprs(asdl_expr_seq*, expr_context_ty, int);
@@ -62,7 +56,7 @@ validate_keywords(asdl_keyword_seq *keywords)
{
Py_ssize_t i;
for (i = 0; i < asdl_seq_LEN(keywords); i++)
- if (!validate_expr(((keyword_ty)asdl_seq_GET(keywords, i))->value, Load))
+ if (!validate_expr((asdl_seq_GET(keywords, i))->value, Load))
return 0;
return 1;
}
@@ -556,7 +550,7 @@ _PyAST_GetDocString(asdl_stmt_seq *body)
if (!asdl_seq_LEN(body)) {
return NULL;
}
- stmt_ty st = (stmt_ty)asdl_seq_GET(body, 0);
+ stmt_ty st = asdl_seq_GET(body, 0);
if (st->kind != Expr_kind) {
return NULL;
}