mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
Issue #20699: Document that “io” methods accept bytes-like objects
This matches the usage of ZipFile and BufferedWriter. This still requires return values to be bytes() objects. Also document and test that the write() methods should only access their argument before they return.
This commit is contained in:
parent
fc36e66af4
commit
6bb91f3b6e
10 changed files with 128 additions and 67 deletions
|
@ -548,7 +548,7 @@ _io.BytesIO.readinto
|
|||
buffer: Py_buffer(accept={rwbuffer})
|
||||
/
|
||||
|
||||
Read up to len(buffer) bytes into buffer.
|
||||
Read bytes into buffer.
|
||||
|
||||
Returns number of bytes read (0 for EOF), or None if the object
|
||||
is set not to block and has no data to read.
|
||||
|
@ -556,7 +556,7 @@ is set not to block and has no data to read.
|
|||
|
||||
static PyObject *
|
||||
_io_BytesIO_readinto_impl(bytesio *self, Py_buffer *buffer)
|
||||
/*[clinic end generated code: output=a5d407217dcf0639 input=b52a8782706f0037]*/
|
||||
/*[clinic end generated code: output=a5d407217dcf0639 input=1424d0fdce857919]*/
|
||||
{
|
||||
Py_ssize_t len, n;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue