<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 19, 2011, at 1:22 PM, Antoine Pitrou wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Wed, 19 Oct 2011 13:10:22 -0400<br>"Itamar Turner-Trauring" &lt;<a href="mailto:itamar@itamarst.org">itamar@itamarst.org</a>&gt; wrote:<br><blockquote type="cite"><blockquote type="cite">For example, I could post the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">following patch for t.p.failure, but would you accept it?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">@@ -464,6 +468,14 @@ class Failure:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# added 2003-06-23. See comment above in __init__<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c['tb'] = None<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Clear other references held by exception objects<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c['value'].__cause__ = None<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c['value'].__context__ = None<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c['value'].__traceback__ = None<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;except AttributeError:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pass<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if self.stack is not None:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# XXX: This is a band-aid. &nbsp;I can't figure out where these<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# (failure.stack is None) instances are coming from.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">That sort of patch would probably be fine, though I'd much rather that be<br></blockquote><blockquote type="cite">inside an if statement that checked the Python version rather than inside<br></blockquote><blockquote type="cite">a try/except. Faster, and much clearer what's going on.<br></blockquote><br>The try/except is necessary because Failures sometimes wrap something<br>else than an exception, and where setting an arbitrary attribute is not<br>allowed.</div></blockquote><br></div><div>This patch would definitely need to be accepted if you expect Twisted to eventually support Python 3. &nbsp;Why do you believe it wouldn't be accepted?</div><div><br></div><div>Of course it would need to have some test coverage - but a first step there is to have a buildbot actually running the tests on py3k.</div><div><br></div><div>Also: if Failures wrap something other than an Exception, that's a bug. &nbsp;in Failure.__doc__, it says: "@ivar value: The exception instance responsible for this failure." &nbsp;If there are cases where non-Exceptions are passed here, then perhaps that behavior should be deprecated before it raises an exception, but <i>something</i>&nbsp;needs to be adjusted so that the documentation is consistent with the implementation.</div><div><br></div><div>-glyph</div><div><br></div></body></html>