Skip to content

Commit 94fb82e

Browse files
committed
Only * can be used for varargs argument lists
1 parent 8dd79cf commit 94fb82e

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

Python/compile.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/***********************************************************
2-
Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The
2+
Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
33
Netherlands.
44
55
All Rights Reserved
@@ -1566,7 +1566,11 @@ com_try_stmt(c, n)
15661566
int finally_anchor = 0;
15671567
int except_anchor = 0;
15681568
REQ(n, try_stmt);
1569-
/* 'try' ':' suite (except_clause ':' suite)* ['finally' ':' suite] */
1569+
/* 'try' ':' suite (except_clause ':' suite)*
1570+
| 'try' ':' 'finally' ':' suite */
1571+
1572+
/* XXX This can be simplified because except and finally can
1573+
no longer be mixed in a single try statement */
15701574

15711575
if (NCH(n) > 3 && TYPE(CHILD(n, NCH(n)-3)) != except_clause) {
15721576
/* Have a 'finally' clause */
@@ -1958,12 +1962,12 @@ com_arglist(c, n)
19581962
int i, nargs, op;
19591963
REQ(n, varargslist);
19601964
/* varargslist:
1961-
(fpdef ',')* ('+'|'*') NAME | fpdef (',' fpdef)* [','] */
1965+
(fpdef ',')* '*' NAME | fpdef (',' fpdef)* [','] */
19621966
op = UNPACK_ARG;
19631967
nargs = (NCH(n) + 1) / 2;
19641968
for (i = 0; i < NCH(n); i += 2) {
19651969
int t = TYPE(CHILD(n, i));
1966-
if (t == PLUS || t == STAR) {
1970+
if (t == STAR) {
19671971
op = UNPACK_VARARG;
19681972
nargs = i/2;
19691973
break;

0 commit comments

Comments
 (0)