Issue 36294: io.BufferedIOBase
returns None
(original) (raw)
Issue36294
Created on 2019-03-14 16:03 by cykerway, last changed 2022-04-11 14:59 by admin. This issue is now closed.
Messages (2) | ||
---|---|---|
msg337941 - (view) | Author: Cyker Way (cykerway) * | Date: 2019-03-14 16:03 |
Document of [BufferedIOBase](https://docs.python.org/3/library/io.html#io.BufferedIOBase) says: > ...unlike their RawIOBase counterparts, they will never return None. But this example shows the above statement is not true: import io import os import sys os.set_blocking(sys.stdin.fileno(), False) print(isinstance(sys.stdin.buffer, io.BufferedIOBase)) print(sys.stdin.buffer.read()) Output: True None | ||
msg337973 - (view) | Author: Martin Panter (martin.panter) * ![]() |
Date: 2019-03-15 08:35 |
The general problem of non-blocking reads with BufferedIOBase is covered by Issue 13322. The documentation and implementations do not agree. I suggest to not rely on any particular behaviour reading BufferedIOBase objects in non-blocking mode. The problem of the concrete class BufferedReader (what “stdin.buffer” usually is) was also recently raised in Issue 35869. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:59:12 | admin | set | github: 80475 |
2019-03-15 08:35:11 | martin.panter | set | status: open -> closedsuperseder: The io module doesn't support non-blocking filesnosy: + martin.pantermessages: + resolution: duplicatestage: resolved |
2019-03-14 16:03:21 | cykerway | create |