mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Only * can be used for varargs argument lists
This commit is contained in:
parent
8dd79cf788
commit
94fb82e461
1 changed files with 8 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The
|
Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
|
||||||
Netherlands.
|
Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
@ -1566,7 +1566,11 @@ com_try_stmt(c, n)
|
||||||
int finally_anchor = 0;
|
int finally_anchor = 0;
|
||||||
int except_anchor = 0;
|
int except_anchor = 0;
|
||||||
REQ(n, try_stmt);
|
REQ(n, try_stmt);
|
||||||
/* 'try' ':' suite (except_clause ':' suite)* ['finally' ':' suite] */
|
/* 'try' ':' suite (except_clause ':' suite)*
|
||||||
|
| 'try' ':' 'finally' ':' suite */
|
||||||
|
|
||||||
|
/* XXX This can be simplified because except and finally can
|
||||||
|
no longer be mixed in a single try statement */
|
||||||
|
|
||||||
if (NCH(n) > 3 && TYPE(CHILD(n, NCH(n)-3)) != except_clause) {
|
if (NCH(n) > 3 && TYPE(CHILD(n, NCH(n)-3)) != except_clause) {
|
||||||
/* Have a 'finally' clause */
|
/* Have a 'finally' clause */
|
||||||
|
@ -1958,12 +1962,12 @@ com_arglist(c, n)
|
||||||
int i, nargs, op;
|
int i, nargs, op;
|
||||||
REQ(n, varargslist);
|
REQ(n, varargslist);
|
||||||
/* varargslist:
|
/* varargslist:
|
||||||
(fpdef ',')* ('+'|'*') NAME | fpdef (',' fpdef)* [','] */
|
(fpdef ',')* '*' NAME | fpdef (',' fpdef)* [','] */
|
||||||
op = UNPACK_ARG;
|
op = UNPACK_ARG;
|
||||||
nargs = (NCH(n) + 1) / 2;
|
nargs = (NCH(n) + 1) / 2;
|
||||||
for (i = 0; i < NCH(n); i += 2) {
|
for (i = 0; i < NCH(n); i += 2) {
|
||||||
int t = TYPE(CHILD(n, i));
|
int t = TYPE(CHILD(n, i));
|
||||||
if (t == PLUS || t == STAR) {
|
if (t == STAR) {
|
||||||
op = UNPACK_VARARG;
|
op = UNPACK_VARARG;
|
||||||
nargs = i/2;
|
nargs = i/2;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue