mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +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
|
|
@ -53,8 +53,9 @@ PyDoc_STRVAR(iobase_doc,
|
|||
"called.\n"
|
||||
"\n"
|
||||
"The basic type used for binary data read from or written to a file is\n"
|
||||
"bytes. bytearrays are accepted too, and in some cases (such as\n"
|
||||
"readinto) needed. Text I/O classes work with str data.\n"
|
||||
"bytes. Other bytes-like objects are accepted as method arguments too.\n"
|
||||
"In some cases (such as readinto), a writable object is required. Text\n"
|
||||
"I/O classes work with str data.\n"
|
||||
"\n"
|
||||
"Note that calling any method (except additional calls to close(),\n"
|
||||
"which are ignored) on a closed stream should raise a ValueError.\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue