mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
Add some asserts and update comments
This commit is contained in:
parent
499b0e638b
commit
c173b488dc
2 changed files with 4 additions and 2 deletions
|
@ -622,10 +622,10 @@ ast_for_arguments(struct compiling *c, const node *n)
|
||||||
}
|
}
|
||||||
args = (n_args ? asdl_seq_new(n_args, c->c_arena) : NULL);
|
args = (n_args ? asdl_seq_new(n_args, c->c_arena) : NULL);
|
||||||
if (!args && n_args)
|
if (!args && n_args)
|
||||||
return NULL; /* Don't need to go to NULL; nothing allocated */
|
return NULL; /* Don't need to goto error; no objects allocated */
|
||||||
defaults = (n_defaults ? asdl_seq_new(n_defaults, c->c_arena) : NULL);
|
defaults = (n_defaults ? asdl_seq_new(n_defaults, c->c_arena) : NULL);
|
||||||
if (!defaults && n_defaults)
|
if (!defaults && n_defaults)
|
||||||
goto error;
|
return NULL; /* Don't need to goto error; no objects allocated */
|
||||||
|
|
||||||
/* fpdef: NAME | '(' fplist ')'
|
/* fpdef: NAME | '(' fplist ')'
|
||||||
fplist: fpdef (',' fpdef)* [',']
|
fplist: fpdef (',' fpdef)* [',']
|
||||||
|
@ -644,6 +644,7 @@ ast_for_arguments(struct compiling *c, const node *n)
|
||||||
expr_ty expression = ast_for_expr(c, CHILD(n, i + 2));
|
expr_ty expression = ast_for_expr(c, CHILD(n, i + 2));
|
||||||
if (!expression)
|
if (!expression)
|
||||||
goto error;
|
goto error;
|
||||||
|
assert(defaults != NULL);
|
||||||
asdl_seq_SET(defaults, j++, expression);
|
asdl_seq_SET(defaults, j++, expression);
|
||||||
i += 2;
|
i += 2;
|
||||||
found_default = 1;
|
found_default = 1;
|
||||||
|
|
|
@ -3031,6 +3031,7 @@ compiler_boolop(struct compiler *c, expr_ty e)
|
||||||
return 0;
|
return 0;
|
||||||
s = e->v.BoolOp.values;
|
s = e->v.BoolOp.values;
|
||||||
n = asdl_seq_LEN(s) - 1;
|
n = asdl_seq_LEN(s) - 1;
|
||||||
|
assert(n >= 0);
|
||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i) {
|
||||||
VISIT(c, expr, (expr_ty)asdl_seq_GET(s, i));
|
VISIT(c, expr, (expr_ty)asdl_seq_GET(s, i));
|
||||||
ADDOP_JREL(c, jumpi, end);
|
ADDOP_JREL(c, jumpi, end);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue