[Python-checkins] python/dist/src/Lib/compiler pyassem.py, 1.31, 1.32

jhylton@users.sourceforge.net jhylton at users.sourceforge.net
Thu Oct 20 21:59:27 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/compiler
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2121/Lib/compiler

Modified Files:
	pyassem.py 
Log Message:
Merge ast-branch to head

This change implements a new bytecode compiler, based on a
transformation of the parse tree to an abstract syntax defined in
Parser/Python.asdl.

The compiler implementation is not complete, but it is in stable
enough shape to run the entire test suite excepting two disabled
tests. 



Index: pyassem.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compiler/pyassem.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- pyassem.py	31 Dec 2002 18:17:42 -0000	1.31
+++ pyassem.py	20 Oct 2005 19:59:24 -0000	1.32
@@ -364,16 +364,15 @@
 
     def getCode(self):
         """Get a Python code object"""
-        if self.stage == RAW:
-            self.computeStackDepth()
-            self.flattenGraph()
-        if self.stage == FLAT:
-            self.convertArgs()
-        if self.stage == CONV:
-            self.makeByteCode()
-        if self.stage == DONE:
-            return self.newCodeObject()
-        raise RuntimeError, "inconsistent PyFlowGraph state"
+        assert self.stage == RAW
+        self.computeStackDepth()
+        self.flattenGraph()
+        assert self.stage == FLAT
+        self.convertArgs()
+        assert self.stage == CONV
+        self.makeByteCode()
+        assert self.stage == DONE
+        return self.newCodeObject()
 
     def dump(self, io=None):
         if io:



More information about the Python-checkins mailing list