Issue 36293: Nonblocking read sys.stdin raises error
Created on 2019-03-14 15:50 by cykerway, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg337940 - (view) | Author: Cyker Way (cykerway) * | Date: 2019-03-14 15:50 | |
This piece of code will raise an error:
import os
import sys
os.set_blocking(sys.stdin.fileno(), False)
sys.stdin.read()
Error:
> TypeError: can't concat NoneType to bytes
Not sure if this is relevant (for a different version of Python): https://bugs.python.org/issue24560
|
|||
| msg337972 - (view) | Author: Martin Panter (martin.panter) * ![]() |
Date: 2019-03-15 08:20 | |
This is the same story as in Issue 35762. Both “sys.stdin” and “subprocess.Popen.stderr” (when universal_newlines=True is enabled) use the TextIOWrapper class, which I don’t think was implemented with non-blocking mode in mind. Issue 24560 is similar, but is about an older class “codecs.StreamReader”. |
|||
| msg338015 - (view) | Author: Terry J. Reedy (terry.reedy) * ![]() |
Date: 2019-03-15 18:59 | |
Martin, did you mean to close this as a duplicate? |
|||
| msg339236 - (view) | Author: Martin Panter (martin.panter) * ![]() |
Date: 2019-03-31 01:12 | |
I wasn’t sure about closing it, in case Cyker came back with more details. E.g. what was the use case? Were they mislead by the documentation? Do they just think the error should be different, or do they think there should be no error in this case? But I suppose we can close this and keep discussion about non-blocking text input together in the existing reports. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:12 | admin | set | github: 80474 |
| 2019-03-31 01:13:11 | martin.panter | set | resolution: duplicate |
| 2019-03-31 01:12:56 | martin.panter | set | status: open -> closed messages:
+ msg339236 |
| 2019-03-15 18:59:01 | terry.reedy | set | nosy:
+ terry.reedy messages: + msg338015 |
| 2019-03-15 08:20:42 | martin.panter | set | superseder: subprocess.Popen with universal_newlines and nonblocking streams fails with "can't concat NoneType to bytes" messages:
+ msg337972 |
| 2019-03-14 15:50:35 | cykerway | create | |
