Ah, I found the problem, for anyone else who runs into this...

I am collecting stacks using the logging system's addObserver() - trying to access the traceback from a garbage-collected deferred. Turns out when the deferred is garbage collected, the failure is pickled (to avoid leaks) and so it sets failure.tb to None.

By the time you get it in your log observer and store it for later, you can't re-raise the exception with the stack. but failure.getTraceback() gave me enough stack to at least debug.

I was hoping for a "real" traceback because Paste's EvalException middleware does a nice job debugging "live" stacks, but the 'verbose' stack is a pretty decent stand-in.

Alec

On Dec 9, 2008, at 5:29 PM, [EMAIL PROTECTED] wrote:

On 12:41 am, [EMAIL PROTECTED] 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
try:
...  1/0
... except:
...  f = Failure()
...
f.printTraceback()
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.

_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to