summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2023-06-15 22:45:13 (GMT)
committerGitHub <noreply@github.com>2023-06-15 22:45:13 (GMT)
commita4056c8f9c2d9970d39e3cb6bffb255cd4b8a42c (patch)
treeefd886491257b999b29b0057e7153640b9d59aac /Python
parent3af2dc7588614c65e9d1178ad9b4a11a19c14dde (diff)
downloadcpython-a4056c8f9c2d9970d39e3cb6bffb255cd4b8a42c.zip
cpython-a4056c8f9c2d9970d39e3cb6bffb255cd4b8a42c.tar.gz
cpython-a4056c8f9c2d9970d39e3cb6bffb255cd4b8a42c.tar.bz2
GH-105588: Add missing error checks to some obj2ast_* converters (GH-105589)
Diffstat (limited to 'Python')
-rw-r--r--Python/Python-ast.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 84bce59..1ffb835 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -10834,6 +10834,7 @@ obj2ast_comprehension(struct ast_state *state, PyObject* obj, comprehension_ty*
Py_CLEAR(tmp);
}
*out = _PyAST_comprehension(target, iter, ifs, is_async, arena);
+ if (*out == NULL) goto failed;
return 0;
failed:
Py_XDECREF(tmp);
@@ -11258,6 +11259,7 @@ obj2ast_arguments(struct ast_state *state, PyObject* obj, arguments_ty* out,
}
*out = _PyAST_arguments(posonlyargs, args, vararg, kwonlyargs, kw_defaults,
kwarg, defaults, arena);
+ if (*out == NULL) goto failed;
return 0;
failed:
Py_XDECREF(tmp);
@@ -11397,6 +11399,7 @@ obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena)
}
*out = _PyAST_arg(arg, annotation, type_comment, lineno, col_offset,
end_lineno, end_col_offset, arena);
+ if (*out == NULL) goto failed;
return 0;
failed:
Py_XDECREF(tmp);
@@ -11519,6 +11522,7 @@ obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out,
}
*out = _PyAST_keyword(arg, value, lineno, col_offset, end_lineno,
end_col_offset, arena);
+ if (*out == NULL) goto failed;
return 0;
failed:
Py_XDECREF(tmp);
@@ -11641,6 +11645,7 @@ obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena*
}
*out = _PyAST_alias(name, asname, lineno, col_offset, end_lineno,
end_col_offset, arena);
+ if (*out == NULL) goto failed;
return 0;
failed:
Py_XDECREF(tmp);
@@ -11690,6 +11695,7 @@ obj2ast_withitem(struct ast_state *state, PyObject* obj, withitem_ty* out,
Py_CLEAR(tmp);
}
*out = _PyAST_withitem(context_expr, optional_vars, arena);
+ if (*out == NULL) goto failed;
return 0;
failed:
Py_XDECREF(tmp);
@@ -11778,6 +11784,7 @@ obj2ast_match_case(struct ast_state *state, PyObject* obj, match_case_ty* out,
Py_CLEAR(tmp);
}
*out = _PyAST_match_case(pattern, guard, body, arena);
+ if (*out == NULL) goto failed;
return 0;
failed:
Py_XDECREF(tmp);