Hello, io.RawIOBase.read() is well specified for behavior in case it immediately gets a would-block condition: "If the object is in non-blocking mode and no bytes are available, None is returned." (https://docs.python.org/3/library/io.html#io.RawIOBase.read). However, nothing is said about such condition for io.IOBase.readline(), which is mixin method in a base class, default implementation of which thus would use io.RawIOBase.read(). Looking at 3.4.0 source, iobase.c: iobase_readline() has: b = _PyObject_CallMethodId(self, &PyId_read, "n", nreadahead); [...] if (!PyBytes_Check(b)) { PyErr_Format(PyExc_IOError, "read() should have returned a bytes object, " "not '%.200s'", Py_TYPE(b)->tp_name); I.e. it's not even ready to receive legitimate return value of None from read(). I didn't try to write a testcase though, so may be missing something. So, how readline() should behave in this case, and can that be specified in the Library Reference? Thanks, Paul mailto:pmiscml at gmail.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4