[Python-ideas] Tulip / PEP 3156 - subprocess events

Guido van Rossum guido at python.org
Sun Jan 20 20:03:22 CET 2013


On Sun, Jan 20, 2013 at 4:36 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Sat, 19 Jan 2013 20:35:04 -0800
> Guido van Rossum <guido at python.org> wrote:
>> IOW, even though a transport may "have" a protocol without a
>> connection, nobody should care about that state, and nobody should be
>> calling its methods (again, write() etc.) in that state. In fact,
>> nobody except event loop internal code should ever have a reference to
>> a transport in that state.
>
> This is just not true. When the connection breaks, the protocol still
> has a reference to the transport and may still be trying to do things
> with the transport (because connection_lost() has not been called yet).

That's a different case though. There once *was* a connection. You are
right that the transport needs to protect itself against the protocol
making further calls to the transport API in this case. Anyway, I
think Nick is okay with the separation between the protocol_factory()
call and the connection_made() call, as long as the future returned by
create_connection() isn't marked done until the connection_made() call
returns. That's an easy fix in the current Tulip code. It's a little
harder though to fix up the PEP to clarify all this...

-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list