Skip to content

Commit dbd807d

Browse files
committed
Keep the error message simple.
1 parent 2f7fbb2 commit dbd807d

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

Doc/library/io.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ In-memory text streams are also available as :class:`StringIO` objects::
6666

6767
.. note::
6868

69-
When working with a non-blocking stream, be aware that operations on text I/O objects
70-
might raise a :exc:`BlockingIOError` if the stream cannot perform a read operation
69+
When working with a non-blocking stream, be aware that read operations on text I/O objects
70+
might raise a :exc:`BlockingIOError` if the stream cannot perform the operation
7171
immediately.
7272

7373

Lib/_pyio.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2525,8 +2525,7 @@ def read(self, size=None):
25252525
if size < 0:
25262526
chunk = self.buffer.read()
25272527
if chunk is None:
2528-
raise BlockingIOError("Unexpected None encountered. This may be due to non-blocking I/O or an issue "
2529-
"with the underlying I/O implementation.")
2528+
raise BlockingIOError("Read returned None.")
25302529
# Read everything.
25312530
result = (self._get_decoded_chars() +
25322531
decoder.decode(chunk, final=True))

Modules/_io/textio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,8 +1993,7 @@ _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n)
19931993
goto fail;
19941994

19951995
if (bytes == Py_None){
1996-
PyErr_SetString(PyExc_BlockingIOError, "Unexpected None encountered. This may be due to non-blocking I/O "
1997-
"or an issue with the underlying I/O implementation.");
1996+
PyErr_SetString(PyExc_BlockingIOError, "Read returned None.");
19981997
return NULL;
19991998

20001999
}

0 commit comments

Comments
 (0)