[Twisted-Python] Twisted for Python 3

Itamar Turner-Trauring itamar at itamarst.org
Wed Oct 19 13:10:22 EDT 2011


> For example, I could post the
> following patch for t.p.failure, but would you accept it?
>
> @@ -464,6 +468,14 @@ class Failure:
>          # added 2003-06-23. See comment above in __init__
>          c['tb'] = None
>
> +        try:
> +            # Clear other references held by exception objects
> +            c['value'].__cause__ = None
> +            c['value'].__context__ = None
> +            c['value'].__traceback__ = None
> +        except AttributeError:
> +            pass
> +
>          if self.stack is not None:
>              # XXX: This is a band-aid.  I can't figure out where these
>              # (failure.stack is None) instances are coming from.

That sort of patch would probably be fine, though I'd much rather that be
inside an if statement that checked the Python version rather than inside
a try/except. Faster, and much clearer what's going on.




More information about the Twisted-Python mailing list