[Python-checkins] python/dist/src/Python graminit.c, 2.38, 2.39 compile.c, 2.348, 2.349

bcannon at users.sourceforge.net bcannon at users.sourceforge.net
Sat Mar 5 07:47:59 CET 2005


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30194/Python

Modified Files:
	graminit.c compile.c 
Log Message:
Allow classes to be defined with empty parentheses.  This means that
``class C(): pass`` is no longer a syntax error.


Index: graminit.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/graminit.c,v
retrieving revision 2.38
retrieving revision 2.39
diff -u -d -r2.38 -r2.39
--- graminit.c	31 Aug 2004 10:07:13 -0000	2.38
+++ graminit.c	5 Mar 2005 06:47:56 -0000	2.39
@@ -1426,26 +1426,27 @@
 	{13, 3},
 	{21, 4},
 };
-static arc arcs_67_3[1] = {
+static arc arcs_67_3[2] = {
 	{9, 5},
+	{15, 6},
 };
 static arc arcs_67_4[1] = {
-	{22, 6},
+	{22, 7},
 };
 static arc arcs_67_5[1] = {
-	{15, 7},
+	{15, 6},
 };
 static arc arcs_67_6[1] = {
-	{0, 6},
+	{21, 4},
 };
 static arc arcs_67_7[1] = {
-	{21, 4},
+	{0, 7},
 };
 static state states_67[8] = {
 	{1, arcs_67_0},
 	{1, arcs_67_1},
 	{2, arcs_67_2},
-	{1, arcs_67_3},
+	{2, arcs_67_3},
 	{1, arcs_67_4},
 	{1, arcs_67_5},
 	{1, arcs_67_6},

Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.348
retrieving revision 2.349
diff -u -d -r2.348 -r2.349
--- compile.c	3 Mar 2005 07:01:48 -0000	2.348
+++ compile.c	5 Mar 2005 06:47:57 -0000	2.349
@@ -4624,7 +4624,7 @@
 	char *name;
 
 	REQ(n, classdef);
-	/* classdef: class NAME ['(' testlist ')'] ':' suite */
+	/* classdef: class NAME ['(' [testlist] ')'] ':' suite */
 	if ((v = PyString_InternFromString(STR(CHILD(n, 1)))) == NULL) {
 		c->c_errors++;
 		return;
@@ -4635,7 +4635,8 @@
 	com_push(c, 1);
 	Py_DECREF(v);
 	/* Push the tuple of base classes on the stack */
-	if (TYPE(CHILD(n, 2)) != LPAR) {
+	if (TYPE(CHILD(n, 2)) != LPAR ||
+			TYPE(CHILD(n, 3)) == RPAR) {
 		com_addoparg(c, BUILD_TUPLE, 0);
 		com_push(c, 1);
 	}



More information about the Python-checkins mailing list