Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4162)

Unified Diff: Modules/parsermodule.c

Issue 14701: parser module doesn't support 'raise ... from'
Patch Set: Created 1 year ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_parser.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Modules/parsermodule.c Sun Apr 29 22:20:01 2012 +0100
+++ b/Modules/parsermodule.c Mon Apr 30 19:58:02 2012 +0100
@@ -1610,32 +1610,29 @@
return (res);
}
-
+/*
+ * 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) {
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);
}
« no previous file with comments | « Lib/test/test_parser.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7