[pypy-svn] r42677 - in pypy/dist/pypy/objspace: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Fri May 4 13:29:38 CEST 2007


Author: cfbolz
Date: Fri May  4 13:29:37 2007
New Revision: 42677

Modified:
   pypy/dist/pypy/objspace/test/test_thunkobjspace.py
   pypy/dist/pypy/objspace/thunk.py
Log:
proposed fix for the test


Modified: pypy/dist/pypy/objspace/test/test_thunkobjspace.py
==============================================================================
--- pypy/dist/pypy/objspace/test/test_thunkobjspace.py	(original)
+++ pypy/dist/pypy/objspace/test/test_thunkobjspace.py	Fri May  4 13:29:37 2007
@@ -100,7 +100,6 @@
         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:

Modified: pypy/dist/pypy/objspace/thunk.py
==============================================================================
--- pypy/dist/pypy/objspace/thunk.py	(original)
+++ pypy/dist/pypy/objspace/thunk.py	Fri May  4 13:29:37 2007
@@ -47,6 +47,7 @@
     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)
@@ -58,6 +59,8 @@
     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:
@@ -65,7 +68,11 @@
                                  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


More information about the pypy-svn mailing list