Commits

Carl Friedrich Bolz committed 8e7d1ae

proposed fix for the test

Comments (0)

Files changed (2)

pypy/objspace/test/test_thunkobjspace.py

         assert lst == [3]
 
     def test_exception_in_thunk(self):
-        skip("thunk about what should happen there!")
         from __pypy__ import lazy
         def f(x):
             if x:

pypy/objspace/thunk.py

     def __init__(w_self, w_callable, args):
         w_self.w_callable = w_callable
         w_self.args = args
+        w_self.operr = None
 
 # special marker to say that w_self has not been computed yet
 w_NOT_COMPUTED_THUNK = W_Thunk(None, None)
     while w_alias is not None:
         if w_alias is w_NOT_COMPUTED_THUNK:
             assert isinstance(w_self, W_Thunk)
+            if w_self.operr is not None:
+                raise w_self.operr
             w_callable = w_self.w_callable
             args       = w_self.args
             if w_callable is None or args is None:
                                  space.wrap("thunk is already being computed"))
             w_self.w_callable = None
             w_self.args       = None
-            w_alias = space.call_args(w_callable, args)
+            try:
+                w_alias = space.call_args(w_callable, args)
+            except OperationError, operr:
+                w_self.operr = operr
+                raise
             # XXX detect circular w_alias result
             w_self.w_thunkalias = w_alias
         w_self = w_alias