Fritz Reese <[email protected]> added the comment:
This is still an issue on Linux in both 3.4 and 3.7 even when using io.open()
as suggested by @vstinner:
>>> import io, os, fcntl
>>> r, w = os.pipe()
>>> fcntl(r, fcntl.F_SETFL, os.O_NONBLOCK)
0
>>> stream = io.open(r, 'rt')
>>> stream
<_io.TextIOWrapper name=X mode='rt' encoding='UTF-8'>
>>> stream.buffer
<_io.BufferedReader name=X>
>>> print(repr(stream.buffer.read()))
None
>>> stream.read()
Traceback (most recent call last):
...
File ".../python3.7/codecs.py"..., in decode
data = self.buffer + input
TypeError: can't concat NoneType to bytes
The error is present in at least 3.4 up to 3.7 where the underlying
buffer.read() returns None which is not handled by the TextIOStream.
----------
nosy: +Fritz Reese
versions: +Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue24560>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com