mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
gh-109523: Raise a BlockingIOError if reading text from a non-blocking stream cannot immediately return bytes. (GH-122933)
This commit is contained in:
parent
930ba0ce60
commit
31f16e427b
7 changed files with 57 additions and 1 deletions
|
@ -1992,6 +1992,12 @@ _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n)
|
|||
if (bytes == NULL)
|
||||
goto fail;
|
||||
|
||||
if (bytes == Py_None){
|
||||
Py_DECREF(bytes);
|
||||
PyErr_SetString(PyExc_BlockingIOError, "Read returned None.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_PyIO_State *state = self->state;
|
||||
if (Py_IS_TYPE(self->decoder, state->PyIncrementalNewlineDecoder_Type))
|
||||
decoded = _PyIncrementalNewlineDecoder_decode(self->decoder,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue