[pypy-svn] r22793 - in pypy/dist/pypy/rpython/memory: . test

mwh at codespeak.net mwh at codespeak.net
Sat Jan 28 15:38:47 CET 2006


Author: mwh
Date: Sat Jan 28 15:38:45 2006
New Revision: 22793

Modified:
   pypy/dist/pypy/rpython/memory/gctransform.py
   pypy/dist/pypy/rpython/memory/test/test_gctransform.py
Log:
(cfbolz, mwh)
don't go looking into the livevars list when it's empty


Modified: pypy/dist/pypy/rpython/memory/gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform.py	(original)
+++ pypy/dist/pypy/rpython/memory/gctransform.py	Sat Jan 28 15:38:45 2006
@@ -110,7 +110,7 @@
             for link in block.exits:
                 livecounts = dict.fromkeys(sets.Set(livevars) - deadinallexits, 1)
                 if (block.exitswitch is c_last_exception and link.exitcase is not None
-                    and livevars[-1] is block.operations[-1].result):
+                    and livevars and livevars[-1] is block.operations[-1].result):
                     # if the last operation in the block raised an
                     # exception, it can't have returned anything that
                     # might need pop_aliving.

Modified: pypy/dist/pypy/rpython/memory/test/test_gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/test/test_gctransform.py	(original)
+++ pypy/dist/pypy/rpython/memory/test/test_gctransform.py	Sat Jan 28 15:38:45 2006
@@ -230,4 +230,13 @@
             return 0
     t = rtype_and_transform(g, [int], gctransform.GCTransformer)
     
-    
+def test_no_livevars_with_exception():
+    def g():
+        raise TypeError
+    def f():
+        try:
+            g()
+        except TypeError:
+            return 0
+        return 1
+    t = rtype_and_transform(f, [], gctransform.GCTransformer)



More information about the Pypy-commit mailing list