@@ -64,6 +64,12 @@ In-memory text streams are also available as :class:`StringIO` objects::
64
64
65
65
f = io.StringIO("some initial text data")
66
66
67
+ .. note ::
68
+
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
71
+ immediately.
72
+
67
73
The text stream API is described in detail in the documentation of
68
74
:class: `TextIOBase `.
69
75
@@ -770,6 +776,11 @@ than raw I/O does.
770
776
Read and return *size * bytes, or if *size * is not given or negative, until
771
777
EOF or if the read call would block in non-blocking mode.
772
778
779
+ .. note ::
780
+
781
+ When the underlying raw stream is non-blocking, a :exc: `BlockingIOError `
782
+ may be raised if a read operation cannot be completed immediately.
783
+
773
784
.. method :: read1(size=-1, /)
774
785
775
786
Read and return up to *size * bytes with only one call on the raw stream.
@@ -779,6 +790,10 @@ than raw I/O does.
779
790
.. versionchanged :: 3.7
780
791
The *size * argument is now optional.
781
792
793
+ .. note ::
794
+
795
+ When the underlying raw stream is non-blocking, a :exc: `BlockingIOError `
796
+ may be raised if a read operation cannot be completed immediately.
782
797
783
798
.. class :: BufferedWriter(raw, buffer_size=DEFAULT_BUFFER_SIZE)
784
799
@@ -1007,6 +1022,11 @@ Text I/O
1007
1022
.. versionchanged :: 3.10
1008
1023
The *encoding * argument now supports the ``"locale" `` dummy encoding name.
1009
1024
1025
+ .. note ::
1026
+
1027
+ When the underlying raw stream is non-blocking, a :exc: `BlockingIOError `
1028
+ may be raised if a read operation cannot be completed immediately.
1029
+
1010
1030
:class: `TextIOWrapper ` provides these data attributes and methods in
1011
1031
addition to those from :class: `TextIOBase ` and :class: `IOBase `:
1012
1032
0 commit comments