@@ -1608,31 +1608,30 @@ validate_return_stmt(node *tree)
16081608}
16091609
16101610
1611+ /*
1612+ * raise_stmt:
1613+ *
1614+ * 'raise' [test ['from' test]]
1615+ */
16111616static int
16121617validate_raise_stmt (node * tree )
16131618{
16141619 int nch = NCH (tree );
16151620 int res = (validate_ntype (tree , raise_stmt )
1616- && ((nch == 1 ) || (nch == 2 ) || (nch == 4 ) || (nch == 6 )));
1621+ && ((nch == 1 ) || (nch == 2 ) || (nch == 4 )));
1622+
1623+ if (!res && !PyErr_Occurred ())
1624+ (void ) validate_numnodes (tree , 2 , "raise" );
16171625
16181626 if (res ) {
16191627 res = validate_name (CHILD (tree , 0 ), "raise" );
16201628 if (res && (nch >= 2 ))
16211629 res = validate_test (CHILD (tree , 1 ));
1622- if (res && nch > 2 ) {
1623- res = (validate_comma (CHILD (tree , 2 ))
1630+ if (res && ( nch == 4 ) ) {
1631+ res = (validate_name (CHILD (tree , 2 ), "from" )
16241632 && validate_test (CHILD (tree , 3 )));
1625- if (res && (nch > 4 ))
1626- res = (validate_comma (CHILD (tree , 4 ))
1627- && validate_test (CHILD (tree , 5 )));
16281633 }
16291634 }
1630- else
1631- (void ) validate_numnodes (tree , 2 , "raise" );
1632- if (res && (nch == 4 ))
1633- res = (validate_comma (CHILD (tree , 2 ))
1634- && validate_test (CHILD (tree , 3 )));
1635-
16361635 return (res );
16371636}
16381637
0 commit comments