[pypy-svn] r16536 - pypy/dist/pypy/interpreter/stablecompiler

arigo at codespeak.net arigo at codespeak.net
Thu Aug 25 19:40:47 CEST 2005


Author: arigo
Date: Thu Aug 25 19:40:46 2005
New Revision: 16536

Modified:
   pypy/dist/pypy/interpreter/stablecompiler/transformer.py
Log:
Found out how the Transformer handles docstring for functions and classes, and
do the same thing for the module top-level.  This gets rid of the first
statement Discard(Const("docstring")) in docstrings, which is what should be
expected according to the examples in the compiler package documentation.


Modified: pypy/dist/pypy/interpreter/stablecompiler/transformer.py
==============================================================================
--- pypy/dist/pypy/interpreter/stablecompiler/transformer.py	(original)
+++ pypy/dist/pypy/interpreter/stablecompiler/transformer.py	Thu Aug 25 19:40:46 2005
@@ -189,6 +189,12 @@
         for node in nodelist:
             if node[0] != token.ENDMARKER and node[0] != token.NEWLINE:
                 self.com_append_stmt(stmts, node)
+
+        if doc is not None:
+            assert isinstance(stmts[0], Discard)
+            assert isinstance(stmts[0].expr, Const)
+            del stmts[0]
+
         return Module(doc, Stmt(stmts))
 
     def eval_input(self, nodelist):



More information about the Pypy-commit mailing list