[Python-checkins] python/nondist/sandbox/ast asdl_c.py,1.10,1.11

jhylton@sourceforge.net jhylton@sourceforge.net
2002年4月16日 16:41:00 -0700


Update of /cvsroot/python/python/nondist/sandbox/ast
In directory usw-pr-cvs1:/tmp/cvs-serv1112
Modified Files:
	asdl_c.py 
Log Message:
Special-case bool in argument checking for ctors.
It's fine for a bool to be intialized as false, so the !arg test made
no sense. Not sure if there's a cleaner way to handle this.
Index: asdl_c.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** asdl_c.py	16 Apr 2002 03:59:10 -0000	1.10
--- asdl_c.py	16 Apr 2002 23:40:58 -0000	1.11
***************
*** 258,262 ****
 emit("p->kind = %s_kind;" % name, 1)
 for argtype, argname, opt in args:
! if not opt:
 emit("if (!%s) {" % argname, 1)
 emit("PyErr_SetString(PyExc_ValueError,", 2)
--- 258,263 ----
 emit("p->kind = %s_kind;" % name, 1)
 for argtype, argname, opt in args:
! # XXX hack alert: false is allowed for a bool
! if not opt and not argtype == "bool":
 emit("if (!%s) {" % argname, 1)
 emit("PyErr_SetString(PyExc_ValueError,", 2)

AltStyle によって変換されたページ (->オリジナル) /