https://github.com/python/cpython/commit/3416ffaa0844477e006eb1245992262d4cf2e69a
commit: 3416ffaa0844477e006eb1245992262d4cf2e69a
branch: 3.12
author: Bénédikt Tran <[email protected]>
committer: sobolevn <[email protected]>
date: 2024-10-31T15:04:17Z
summary:
[3.12] gh-126240: handle `NULL` returned by `_Py_asdl_expr_seq_new`
(GH-126241) (#126245)
gh-126240: handle `NULL` returned by `_Py_asdl_expr_seq_new` (#126241)
check return value of `_Py_asdl_expr_seq_new`
files:
M Parser/action_helpers.c
diff --git a/Parser/action_helpers.c b/Parser/action_helpers.c
index 085622e6551203..be52d89495c7dc 100644
--- a/Parser/action_helpers.c
+++ b/Parser/action_helpers.c
@@ -1043,6 +1043,9 @@ expr_ty _PyPegen_collect_call_seqs(Parser *p,
asdl_expr_seq *a, asdl_seq *b,
}
asdl_expr_seq *args = _Py_asdl_expr_seq_new(total_len, arena);
+ if (args == NULL) {
+ return NULL;
+ }
Py_ssize_t i = 0;
for (i = 0; i < args_len; i++) {
@@ -1210,6 +1213,9 @@ unpack_top_level_joined_strs(Parser *p, asdl_expr_seq
*raw_expressions) {
}
asdl_expr_seq *expressions = _Py_asdl_expr_seq_new(req_size, p->arena);
+ if (expressions == NULL) {
+ return NULL;
+ }
Py_ssize_t raw_index, req_index = 0;
for (raw_index = 0; raw_index < raw_size; raw_index++) {
@@ -1400,6 +1406,9 @@ expr_ty _PyPegen_formatted_value(Parser *p, expr_ty
expression, Token *debug,
}
asdl_expr_seq *values = _Py_asdl_expr_seq_new(2, arena);
+ if (values == NULL) {
+ return NULL;
+ }
asdl_seq_SET(values, 0, debug_text);
asdl_seq_SET(values, 1, formatted_value);
return _PyAST_JoinedStr(values, lineno, col_offset, debug_end_line,
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]