[pypy-svn] rev 1579 - in pypy/trunk/src/pypy: objspace/flow translator translator/test

hpk at codespeak.net hpk at codespeak.net
Sat Oct 4 17:52:25 CEST 2003


Author: hpk
Date: Sat Oct  4 17:52:25 2003
New Revision: 1579

Modified:
   pypy/trunk/src/pypy/objspace/flow/objspace.py
   pypy/trunk/src/pypy/translator/genpyrex.py
   pypy/trunk/src/pypy/translator/simplify.py
   pypy/trunk/src/pypy/translator/test/test_annotation.py
   pypy/trunk/src/pypy/translator/test/test_pyrextrans.py
   pypy/trunk/src/pypy/translator/test/test_simplify.py
   pypy/trunk/src/pypy/translator/test/test_sourcegen.py
   pypy/trunk/src/pypy/translator/test/test_typedpyrex.py
Log:
fixed all issues in order to make the complete 
test-suite work again


Modified: pypy/trunk/src/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/objspace.py	(original)
+++ pypy/trunk/src/pypy/objspace/flow/objspace.py	Sat Oct  4 17:52:25 2003
@@ -8,6 +8,7 @@
 from pypy.translator.flowmodel import *
 from pypy.objspace.flow import flowcontext
 
+debug = 0
 # ______________________________________________________________________
 class FlowObjSpace(ObjSpace):
     def initialize(self):
@@ -110,7 +111,7 @@
         elif name == 'id':
             op = id
         else:
-            print >> sys.stderr, "XXX missing operator:", name
+            if debug: print >> sys.stderr, "XXX missing operator:", name
 
     def generic_operator(self, *args_w):
         assert len(args_w) == arity, name+" got the wrong number of arguments"

Modified: pypy/trunk/src/pypy/translator/genpyrex.py
==============================================================================
--- pypy/trunk/src/pypy/translator/genpyrex.py	(original)
+++ pypy/trunk/src/pypy/translator/genpyrex.py	Sat Oct  4 17:52:25 2003
@@ -54,7 +54,7 @@
         return "\n".join(lines)
 
     def op_getitem(self):
-        return "%s = %s[%s]" % (self.resultname,) + self.argnames
+        return "%s = %s[%s]" % ((self.resultname,) + tuple(self.argnames))
 
     def op_newtuple(self):
         if self.argnames:
@@ -90,7 +90,6 @@
         else: 
             return "%s = getattr(%s)" % (self.resultname, ", ".join(args))
 
-
 class GenPyrex:
     def __init__(self, functiongraph):
         self.functiongraph = functiongraph
@@ -117,8 +116,8 @@
         return "\n".join(self.lines)
 
     def putline(self, line):
-        if line:
-            self.lines.append("  " * self.indent + line)
+        for l in line.split('\n'):
+            self.lines.append("  " * self.indent + l)
 
     def gen_Graph(self):
         fun = self.functiongraph

Modified: pypy/trunk/src/pypy/translator/simplify.py
==============================================================================
--- pypy/trunk/src/pypy/translator/simplify.py	(original)
+++ pypy/trunk/src/pypy/translator/simplify.py	Sat Oct  4 17:52:25 2003
@@ -2,8 +2,6 @@
 generate Pyrex files from the flowmodel. 
 
 """
-import autopath
-from pypy.tool import test
 from pypy.interpreter.baseobjspace import ObjSpace
 from pypy.translator.flowmodel import *
 
@@ -56,6 +54,7 @@
                     prevbranch.target = nextbranch.target
                 #print "eliminated", node, nextbranch
                 victims = True
+                # restart the elimination-for loop cleanly
                 break
     return graph
 

Modified: pypy/trunk/src/pypy/translator/test/test_annotation.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/test_annotation.py	(original)
+++ pypy/trunk/src/pypy/translator/test/test_annotation.py	Sat Oct  4 17:52:25 2003
@@ -6,7 +6,7 @@
 from pypy.translator.annotation import Annotator, set_type, get_type
 from pypy.translator.flowmodel import *
 
-class TestCase(test.IntTestCase):
+class AnnonateTestCase(test.IntTestCase):
     def setUp(self):
         self.space = test.objspace('flow')
 
@@ -127,7 +127,8 @@
         a = Annotator(fun)
         input_ann = []
         set_type(fun.get_args()[0], int, input_ann)
-        import sys; print >> sys.stderr, a.build_annotations(input_ann)
+        #import sys; print >> sys.stderr, a.build_annotations(input_ann)
+        a.build_annotations(input_ann)
         end_var, end_ann = a.end_annotations()
         self.assertEquals(get_type(end_var, end_ann), int)
 

Modified: pypy/trunk/src/pypy/translator/test/test_pyrextrans.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/test_pyrextrans.py	(original)
+++ pypy/trunk/src/pypy/translator/test/test_pyrextrans.py	Sat Oct  4 17:52:25 2003
@@ -1,4 +1,3 @@
-
 import autopath
 from pypy.tool import test
 from pypy.tool.udir import udir
@@ -6,14 +5,14 @@
 from pypy.translator.flowmodel import *
 from pypy.translator.test.buildpyxmodule import make_module_from_pyxstring
 
-make_dot = 1
+make_dot = 0
 
 if make_dot: 
     from pypy.translator.test.make_dot import make_dot
 else:
     def make_dot(*args): pass
 
-class TestCase(test.IntTestCase):
+class PyrexGenTestCase(test.IntTestCase):
     def setUp(self):
         self.space = test.objspace('flow')
 
@@ -27,7 +26,7 @@
         name = func.func_name
         funcgraph = self.space.build_flow(func)
         from pypy.translator.simplify import eliminate_empty_blocks
-        eliminate_empty_blocks(funcgraph)
+        #eliminate_empty_blocks(funcgraph)
         funcgraph.source = inspect.getsource(func)
         result = GenPyrex(funcgraph).emitcode()
         make_dot(funcgraph, udir, 'ps')

Modified: pypy/trunk/src/pypy/translator/test/test_simplify.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/test_simplify.py	(original)
+++ pypy/trunk/src/pypy/translator/test/test_simplify.py	Sat Oct  4 17:52:25 2003
@@ -6,7 +6,7 @@
 from pypy.translator.test.buildpyxmodule import make_module_from_pyxstring
 from pypy.translator.simplify import eliminate_empty_blocks
 
-make_dot = 1
+make_dot = 0
 
 if make_dot: 
     from pypy.translator.test.make_dot import make_dot

Modified: pypy/trunk/src/pypy/translator/test/test_sourcegen.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/test_sourcegen.py	(original)
+++ pypy/trunk/src/pypy/translator/test/test_sourcegen.py	Sat Oct  4 17:52:25 2003
@@ -9,7 +9,7 @@
 from pypy.translator.test.buildpyxmodule import make_module_from_pyxstring
 #from pypy.translator.test.make_dot import make_ps
 
-class TestCase(test.IntTestCase):
+class SourceGenTestCase(test.IntTestCase):
     def test_simple_func(self):
         """
         one test source:

Modified: pypy/trunk/src/pypy/translator/test/test_typedpyrex.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/test_typedpyrex.py	(original)
+++ pypy/trunk/src/pypy/translator/test/test_typedpyrex.py	Sat Oct  4 17:52:25 2003
@@ -6,14 +6,14 @@
 from pypy.translator.flowmodel import *
 from pypy.translator.test.buildpyxmodule import make_module_from_pyxstring
 
-make_dot = 1
+make_dot = 0
 
 if make_dot: 
     from pypy.translator.test.make_dot import make_dot
 else:
     def make_dot(*args): pass
 
-class TestCase(test.IntTestCase):
+class TypedPyrexTestCase(test.IntTestCase):
     def setUp(self):
         self.space = test.objspace('flow')
 


More information about the Pypy-commit mailing list