[Python-checkins] python/dist/src/Modules parsermodule.c,2.85,2.86
bcannon at users.sourceforge.net
bcannon at users.sourceforge.net
Sat Apr 9 04:30:47 CEST 2005
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10651/Modules
Modified Files:
parsermodule.c
Log Message:
Flush out support for ``class B(): pass`` syntax by adding support to the
'parser' module and 'compiler' package.
Closes patch #1176012. Thanks logistix.
Index: parsermodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v
retrieving revision 2.85
retrieving revision 2.86
diff -u -d -r2.85 -r2.86
--- parsermodule.c 31 Aug 2004 10:07:12 -0000 2.85
+++ parsermodule.c 9 Apr 2005 02:30:14 -0000 2.86
@@ -947,7 +947,8 @@
validate_class(node *tree)
{
int nch = NCH(tree);
- int res = validate_ntype(tree, classdef) && ((nch == 4) || (nch == 7));
+ int res = (validate_ntype(tree, classdef) &&
+ ((nch == 4) || (nch == 6) || (nch == 7)));
if (res) {
res = (validate_name(CHILD(tree, 0), "class")
@@ -955,12 +956,20 @@
&& validate_colon(CHILD(tree, nch - 2))
&& validate_suite(CHILD(tree, nch - 1)));
}
- else
+ else {
(void) validate_numnodes(tree, 4, "class");
- if (res && (nch == 7)) {
- res = (validate_lparen(CHILD(tree, 2))
- && validate_testlist(CHILD(tree, 3))
- && validate_rparen(CHILD(tree, 4)));
+ }
+
+ if (res) {
+ if (nch == 7) {
+ res = ((validate_lparen(CHILD(tree, 2)) &&
+ validate_testlist(CHILD(tree, 3)) &&
+ validate_rparen(CHILD(tree, 4))));
+ }
+ else if (nch == 6) {
+ res = (validate_lparen(CHILD(tree,2)) &&
+ validate_rparen(CHILD(tree,3)));
+ }
}
return (res);
}
More information about the Python-checkins
mailing list