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

Paul Moore p.f.moore at gmail.com
Tue Jan 22 13:03:43 CET 2013


On 19 January 2013 12:12, Paul Moore <p.f.moore at gmail.com> wrote:
>> I would love for you to create that version. I only checked it in so I
>> could point to it -- I am not happy with either the implementation,
>> the API spec, or the unit test...
>
> May be a few days before I can get to it.

OK, I finally have a working VM.

The subprocess test code assumes that it can call
transport.write_eof() in the protocol connection_made() function. I'm
not sure if that is fundamental, or just an artifact of the current
implementation. Certainly if you have a stdin pipe open, you likely
want to close it to avoid deadlocks, but with the subprocess.Popen
approach, it's entirely possible to not open a pipe to stdin. In that
case, writing to stdin is neither possible nor necessary.

Clearly, writing data to stdin if you didn't open a pipe should be
flagged as an error. And my immediate thought is that write_eof should
also be an error. But I can imagine people wanting to write reusable
protocols that pre-emptively write EOF to the stdin pipe to avoid
deadlocks.

So, a question: If the user passed a popen object without a stdin
pipe, should write_eof be an error or should it just silently do
nothing?

Paul



More information about the Python-ideas mailing list