mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +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
|
@ -836,7 +836,7 @@ _io.FileIO.write
|
|||
b: Py_buffer
|
||||
/
|
||||
|
||||
Write bytes b to file, return number written.
|
||||
Write buffer b to file, return number of bytes written.
|
||||
|
||||
Only makes one system call, so not all of the data may be written.
|
||||
The number of bytes actually written is returned. In non-blocking mode,
|
||||
|
@ -845,7 +845,7 @@ returns None if the write would block.
|
|||
|
||||
static PyObject *
|
||||
_io_FileIO_write_impl(fileio *self, Py_buffer *b)
|
||||
/*[clinic end generated code: output=b4059db3d363a2f7 input=ffbd8834f447ac31]*/
|
||||
/*[clinic end generated code: output=b4059db3d363a2f7 input=6e7908b36f0ce74f]*/
|
||||
{
|
||||
Py_ssize_t n;
|
||||
int err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue