Martin Panter added the comment:

Yes, I think the special return value of None is only standard to the “io” 
module, which was added in Python 2.6 and 3. And even there it is inconsistent.

For what it’s worth, don’t have strong opinions on the special non-blocking and 
broken pipe cases, as long as they can be differentiated. So the current 
situation is fine by me. Just that potentially surprising differences with 
other APIs [e.g. read() -> b"" means empty buffer, not closed pipe] need 
documenting.

The asyncio.StreamReader.read() etc methods are documented as coroutines, so 
the problem of differentiating an empty buffer from a closed pipe does not 
exist there.

Just a thought: would it make sense for these methods to be decoupled from the 
subprocess class, and generalized to apply to any pipes, as a kind of Windows 
vs POSIX abstraction layer? Then you wouldn’t have to add duplicate methods 
like read_stderr_available() and read_stderr_exactly() all the time. You might 
also have a more portable way of doing non-blocking reads from sys.stdin, etc 
as well.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1191964>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to