Eryk Sun <eryk...@gmail.com> added the comment:

communicate() is incomplete, so decoding the output may fail. For example, say 
the encoding is UTF-8, and the last multibyte character sequence (2-4 bytes) is 
incomplete. Maybe communicate() should always set `stdout_bytes` and 
`stderr_bytes` attributes on the timeout exception, and, in text mode, try to 
decode the output as `stdout` and/or `stderr`. If decoding fails, set the 
decoded value to None.

In Windows, run() tries to complete communication, which is dysfunctional in 
cases. I created bpo-43346 to propose changing the design in Windows, in order 
to address 3 cases that can cause subprocess.run() to ignore the given timeout. 
The proposed change also sets an incomplete read of stdout and stderr as bytes 
objects, regardless of text mode, because I was simply matching what POSIX does 
in this case.

----------
nosy: +eryksun, giampaolo.rodola
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.7

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

Reply via email to