Author: tack
Date: Sat Feb 16 19:46:14 2008
New Revision: 3112

Log:
Create AsyncException object in throw() rather than get_result().  This 
fixes a bug when coroutine.py's _process calls throw() on the generator,
because as it was, _exception[2] was a stack object not a traceback, so
the raise failed.  Now _exception[1] contains an AsyncException object
so this is thrown to the generator.


Modified:
   trunk/base/src/notifier/async.py

Modified: trunk/base/src/notifier/async.py
==============================================================================
--- trunk/base/src/notifier/async.py    (original)
+++ trunk/base/src/notifier/async.py    Sat Feb 16 19:46:14 2008
@@ -285,7 +285,9 @@
 
         # Remove traceback from stored exception.  If any waiting threads
         # haven't gotten it by now, it's too late.
-        self._exception = type, value, stack
+        if not isinstance(value, AsyncExceptionBase):
+            value = AsyncException(value, stack)
+        self._exception = value.__class__, value, None
 
         # cleanup
         self.disconnect_all()
@@ -342,16 +344,14 @@
             raise RuntimeError('operation not finished')
         if self._exception:
             self._unhandled_exception = None
-            exc_type, exc_value, exc_tb_or_stack = self._exception
-            if type(exc_tb_or_stack) == types.TracebackType:
+            if self._exception[2]:
                 # We have the traceback, so we can raise using it.
+                exc_type, exc_value, exc_tb_or_stack = self._exception
                 raise exc_type, exc_value, exc_tb_or_stack
             else:
                 # No traceback, so construct an AsyncException based on the
                 # stack.
-                if not isinstance(exc_value, AsyncExceptionBase):
-                    exc_value = AsyncException(exc_value, exc_tb_or_stack)
-                raise exc_value
+                raise self._exception[1]
 
         return self._result
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to