[Twisted-Python] lost tracebacks?

glyph at divmod.com glyph at divmod.com
Tue Dec 9 20:29:22 EST 2008

On 12:41 am, alecf at metaweb.com wrote:
>I traced this down to the code in Deferred._runCallbacks() which does 
>a try: / except: with::
>     self.result = failure.Failure()
>Seems like this code should say::
>     exc_type, exc_value, exc_traceback = sys.exc_info()
>     self.result = failure.Failure(exc_value, exc_type, exc_traceback)

Those are basically equivalent.  Observe:
>>>from twisted.python.failure import Failure
...  1/0
... except:
...  f = Failure()
Traceback (most recent call last):
--- <exception caught here> ---
  File "<stdin>", line 2, in <module>

exceptions.ZeroDivisionError: integer division or modulo by zero

Note how it remembers the line number in the traceback.  Your traceback 
must be getting lost for some other reason.

More information about the Twisted-Python mailing list