mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
GH-105588: Add missing error checks to some obj2ast_* converters (GH-105589)
This commit is contained in:
parent
3af2dc7588
commit
a4056c8f9c
4 changed files with 37 additions and 0 deletions
7
Python/Python-ast.c
generated
7
Python/Python-ast.c
generated
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue