[pypy-svn] r10937 - pypy/dist/pypy/translator/test

arigo at codespeak.net arigo at codespeak.net
Wed Apr 20 19:39:34 CEST 2005


Author: arigo
Date: Wed Apr 20 19:39:34 2005
New Revision: 10937

Modified:
   pypy/dist/pypy/translator/test/snippet.py
   pypy/dist/pypy/translator/test/test_annrpython.py
Log:
A test that shows the next problem.


Modified: pypy/dist/pypy/translator/test/snippet.py
==============================================================================
--- pypy/dist/pypy/translator/test/snippet.py	(original)
+++ pypy/dist/pypy/translator/test/snippet.py	Wed Apr 20 19:39:34 2005
@@ -762,6 +762,9 @@
     return Exc()
 
 
+def always_raising(x):
+    raise ValueError
+
 def witness(x):
     pass
 
@@ -876,6 +879,12 @@
     return mod3.p()
 
 
+
+def call_two_funcs_but_one_can_only_raise(n):
+    fn = [witness, always_raising][n]
+    return fn(n)
+
+
 class BltinCode:
   def __init__(self, func, framecls):
     self.func = func

Modified: pypy/dist/pypy/translator/test/test_annrpython.py
==============================================================================
--- pypy/dist/pypy/translator/test/test_annrpython.py	(original)
+++ pypy/dist/pypy/translator/test/test_annrpython.py	Wed Apr 20 19:39:34 2005
@@ -927,8 +927,13 @@
 
         assert s.items[0].knowntype == bool and not s.items[0].is_constant()
         assert s.items[1].knowntype == bool and not s.items[1].is_constant()
-                
-        
+
+    def test_call_two_funcs_but_one_can_only_raise(self):
+        a = self.RPythonAnnotator()
+        s = a.build_types(snippet.call_two_funcs_but_one_can_only_raise,
+                          [int])
+        assert s == a.bookkeeper.immutablevalue(None)
+
 
 def g(n):
     return [0,1,2,n]



More information about the Pypy-commit mailing list