From 6bb91f3b6e51352f91bcf785d3f6fe160ed2cd85 Mon Sep 17 00:00:00 2001 From: Martin Panter Date: Sat, 28 May 2016 00:41:57 +0000 Subject: =?UTF-8?q?Issue=20#20699:=20Document=20that=20=E2=80=9Cio?= =?UTF-8?q?=E2=80=9D=20methods=20accept=20bytes-like=20objects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Modules/_io/bufferedio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Modules/_io/bufferedio.c') diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index 625a61ebf8..6d67751c7d 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -190,8 +190,8 @@ bufferediobase_read1(PyObject *self, PyObject *args) PyDoc_STRVAR(bufferediobase_write_doc, "Write the given buffer to the IO stream.\n" "\n" - "Returns the number of bytes written, which is never less than\n" - "len(b).\n" + "Returns the number of bytes written, which is always the length of b\n" + "in bytes.\n" "\n" "Raises BlockingIOError if the buffer is full and the\n" "underlying raw stream cannot accept more data at the moment.\n"); -- cgit v1.2.1