diff options
author | Mark Dickinson <mdickinson@enthought.com> | 2012-05-07 11:03:11 (GMT) |
---|---|---|
committer | Mark Dickinson <mdickinson@enthought.com> | 2012-05-07 11:03:11 (GMT) |
commit | 9fad1604110cd7a0bb32792aa6d6c6a63018d51e (patch) | |
tree | 6bed6f14f66a1ec3fb9fa30c70c97cdd05f9df90 /Modules | |
parent | 99e2e5552ab6a105b188273658784963bb9a915c (diff) | |
parent | cf360b92099d3ebcd31f637e45df501f393ff0b0 (diff) | |
download | cpython-9fad1604110cd7a0bb32792aa6d6c6a63018d51e.zip cpython-9fad1604110cd7a0bb32792aa6d6c6a63018d51e.tar.gz cpython-9fad1604110cd7a0bb32792aa6d6c6a63018d51e.tar.bz2 |
Issue #14701: Merge fix from 3.2.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/parsermodule.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index b4202aa..af14657 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -1611,31 +1611,30 @@ validate_return_stmt(node *tree) } +/* + * raise_stmt: + * + * 'raise' [test ['from' test]] + */ static int validate_raise_stmt(node *tree) { int nch = NCH(tree); int res = (validate_ntype(tree, raise_stmt) - && ((nch == 1) || (nch == 2) || (nch == 4) || (nch == 6))); + && ((nch == 1) || (nch == 2) || (nch == 4))); + + if (!res && !PyErr_Occurred()) + (void) validate_numnodes(tree, 2, "raise"); if (res) { res = validate_name(CHILD(tree, 0), "raise"); if (res && (nch >= 2)) res = validate_test(CHILD(tree, 1)); - if (res && nch > 2) { - res = (validate_comma(CHILD(tree, 2)) + if (res && (nch == 4)) { + res = (validate_name(CHILD(tree, 2), "from") && validate_test(CHILD(tree, 3))); - if (res && (nch > 4)) - res = (validate_comma(CHILD(tree, 4)) - && validate_test(CHILD(tree, 5))); } } - else - (void) validate_numnodes(tree, 2, "raise"); - if (res && (nch == 4)) - res = (validate_comma(CHILD(tree, 2)) - && validate_test(CHILD(tree, 3))); - return (res); } |