[Python-checkins] CVS: python/dist/src/Python compile.c,2.164,2.165
Tim Peters
tim_one@users.sourceforge.net
Sat, 17 Feb 2001 20:45:12 -0800
- Previous message: [Python-checkins] CVS: python/dist/src/Lib Queue.py,1.13,1.14 UserDict.py,1.10,1.11 UserList.py,1.15,1.16 anydbm.py,1.9,1.10 bisect.py,1.6,1.7 chunk.py,1.8,1.9 dumbdbm.py,1.8,1.9 htmlentitydefs.py,1.7,1.8 mutex.py,1.8,1.9 nturl2path.py,1.9,1.10 posixfile.py,1.18,1.19 regex_syntax.py,1.5,1.6 stat.py,1.9,1.10 statvfs.py,1.6,1.7 string.py,1.58,1.59
- Next message: [Python-checkins] CVS: python/dist/src/Modules _weakref.c,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv19963/python/dist/src/Python
Modified Files:
compile.c
Log Message:
Bug #132313 error message confusing for assignment in lambda.
They're actually complaining about something more specific, an assignment
in a lambda as an actual argument, so that Python parses the
lambda as if it were a keyword argument. Like f(lambda x: x[0]=42).
The "lambda x: x[0]" part gets parsed as if it were a keyword, being
bound to 42, and the resulting error msg didn't make much sense.
Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.164
retrieving revision 2.165
diff -C2 -r2.164 -r2.165
*** compile.c 2001/02/17 05:30:26 2.164
--- compile.c 2001/02/18 04:45:10 2.165
***************
*** 1523,1528 ****
} while (NCH(m) == 1);
if (TYPE(m) != NAME) {
com_error(c, PyExc_SyntaxError,
! "keyword can't be an expression");
}
else {
--- 1523,1535 ----
} while (NCH(m) == 1);
if (TYPE(m) != NAME) {
+ /* f(lambda x: x[0] = 3) ends up getting parsed with
+ * LHS test = lambda x: x[0], and RHS test = 3.
+ * SF bug 132313 points out that complaining about a keyword
+ * then is very confusing.
+ */
com_error(c, PyExc_SyntaxError,
! TYPE(m) == lambdef ?
! "lambda cannot contain assignment" :
! "keyword can't be an expression");
}
else {
- Previous message: [Python-checkins] CVS: python/dist/src/Lib Queue.py,1.13,1.14 UserDict.py,1.10,1.11 UserList.py,1.15,1.16 anydbm.py,1.9,1.10 bisect.py,1.6,1.7 chunk.py,1.8,1.9 dumbdbm.py,1.8,1.9 htmlentitydefs.py,1.7,1.8 mutex.py,1.8,1.9 nturl2path.py,1.9,1.10 posixfile.py,1.18,1.19 regex_syntax.py,1.5,1.6 stat.py,1.9,1.10 statvfs.py,1.6,1.7 string.py,1.58,1.59
- Next message: [Python-checkins] CVS: python/dist/src/Modules _weakref.c,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]