Opened 5 years ago

Last modified 5 years ago

#6786 enhancement new

twisted.internet.error.ConnectionClosed.__str__ fails when running with -O2

Reported by: Tom Prince Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author:

Description

This is because __str__ looks at __doc__ but that is None.

Attachments (1)

internet-errors-in-OO-mode.patch (2.7 KB) - added by Adam 3 years ago.
How about the following patch to at least get it working in -OO?

Download all attachments as: .zip

Change History (4)

comment:1 Changed 5 years ago by Jean-Paul Calderone

Not just ConnectionClosed either. A lot of twisted.internet.error consult __doc__.

How badly do we want to support Python in "optimized" mode?

comment:2 Changed 5 years ago by Jean-Paul Calderone

Also... ConnectionClosed is one of the few exceptions in this module that doesn't use __str__. Perhaps you meant ConnectionLost?

comment:3 Changed 5 years ago by Jean-Paul Calderone

I suppose the thing to do is re-implement this functionality so as not to use __doc__ at all.

That way we don't have to worry ourselves about trying to run the tests using different optimization settings because those settings won't be relevant to the implementation anymore (which we will just have to verify by inspection).

Changed 3 years ago by Adam

How about the following patch to at least get it working in -OO?

Note: See TracTickets for help on using tickets.