On Tuesday, 16 June 2020 10:51:21 CEST Glyph wrote:
> > On Jun 15, 2020, at 8:43 PM, Craig Rodrigues
> > <rodr...@crodrigues.org> wrote:
> > 
> > In twisted.internet.abstract.FileDescriptor.loseConnection, the
> > loseConnection method> 
> > is defined like:
> >     def loseConnection(self, 
_connDone=failure.Failure(main.CONNECTION_DONE)):
> I think this signature might just be... wrong?  ITransport doesn't
> include it.  Does anything actually use this argument?

I think this isn't actually an argument: the underscore in the name 
suggests it is not part of the interface. What seems to be happening 
here is that twisted.internet.abstract.FileDescriptor.loseConnection 
defines a constant by putting it in an argument default value.

A simple solution would be to replace it by a class-scope or module-
scope constant.


By the way, is it valid to wrap an exception that was never raised in a 
Failure object? Because that is what happens here by reusing the single 
_connDone instance. It seems Failure's implementation is prepared to 
handle it, but its docstring doesn't mention it.

Bye,
                Maarten



_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to