[Python-checkins] CVS: python/dist/src/Tools/compiler/compiler transformer.py,1.17,1.18
Jeremy Hylton
python-dev@python.org
Sun, 5 Nov 2000 19:33:54 -0800
Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler
In directory slayer.i.sourceforge.net:/tmp/cvs-serv18510
Modified Files:
transformer.py
Log Message:
If a function contains a doc string, remove the doc string node from
the function's body.
If assert is used without an error message, make the AST node None
rather than Name('None').
Index: transformer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/transformer.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** transformer.py 2000/10/25 18:10:32 1.17
--- transformer.py 2000/11/06 03:33:52 1.18
***************
*** 174,177 ****
--- 174,181 ----
code = self.com_node(nodelist[4])
+ if doc is not None:
+ assert isinstance(code, Stmt)
+ assert isinstance(code.nodes[0], Discard)
+ del code.nodes[0]
n = Function(name, names, defaults, flags, doc, code)
n.lineno = lineno
***************
*** 401,405 ****
expr2 = self.com_node(nodelist[3])
else:
! expr2 = Name('None')
n = Assert(expr1, expr2)
n.lineno = nodelist[0][2]
--- 405,409 ----
expr2 = self.com_node(nodelist[3])
else:
! expr2 = None
n = Assert(expr1, expr2)
n.lineno = nodelist[0][2]