[issue43431] Subprocess timeout causes output to be returned as bytes in text mode

2021-03-07 Thread Jordan Macdonald
New submission from Jordan Macdonald : Passing the argument `text=True` to `subprocess.run()` is supposed to mean that any captured output of the called process is automatically decoded and retuned to the user as test instead of bytes. However, if you give a timeout and that timeout expires,

[issue43431] Subprocess timeout causes output to be returned as bytes in text mode

2021-03-08 Thread Eryk Sun
Eryk Sun 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 tim

[issue43431] Subprocess timeout causes output to be returned as bytes in text mode

2021-03-08 Thread Jordan Macdonald
Jordan Macdonald added the comment: Eryk Sun: Well, I think step 1 should be to update the documentation for Python 3.7 through 3.10 on `subprocess.run()` and `subprocess.TimeoutExpired` to clearly state that `TimeoutExpired.stdout` and `TimeoutExpired.stderr` will be in bytes format even if

[issue43431] Subprocess timeout causes output to be returned as bytes in text mode

2021-03-30 Thread Eryk Sun
Change by Eryk Sun : -- versions: -Python 3.7 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p