From c4c00ac8610f16b6d9b6c990d9c8cb7a12e9899e Mon Sep 17 00:00:00 2001 From: Marcin Niemira Date: Thu, 4 Apr 2019 19:07:07 +1100 Subject: [PATCH 1/4] add writelines docs to IOBase -issue 36523 --- Modules/_io/clinic/iobase.c.h | 8 ++++++-- Modules/_io/iobase.c | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Modules/_io/clinic/iobase.c.h b/Modules/_io/clinic/iobase.c.h index a5c8eea3ec3aed..ddaff7b5d135d8 100644 --- a/Modules/_io/clinic/iobase.c.h +++ b/Modules/_io/clinic/iobase.c.h @@ -242,7 +242,11 @@ _io__IOBase_readlines(PyObject *self, PyObject *const *args, Py_ssize_t nargs) PyDoc_STRVAR(_io__IOBase_writelines__doc__, "writelines($self, lines, /)\n" "--\n" -"\n"); +"\n" +"Write a list of lines to stream.\n" +"\n" +"Line separators are not added, so it is usual for each of the\n" +"lines provided to have a line separator at the end."); #define _IO__IOBASE_WRITELINES_METHODDEF \ {"writelines", (PyCFunction)_io__IOBase_writelines, METH_O, _io__IOBase_writelines__doc__}, @@ -311,4 +315,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored)) { return _io__RawIOBase_readall_impl(self); } -/*[clinic end generated code: output=60e43a7cbd9f314e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=61b6ea7153ef9940 input=a9049054013a1b77]*/ diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c index 3a8f16ae0b6589..6a0d9bec5af320 100644 --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -751,11 +751,16 @@ _io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint) _io._IOBase.writelines lines: object / + +Write a list of lines to stream. + +Line separators are not added, so it is usual for each of the +lines provided to have a line separator at the end. [clinic start generated code]*/ static PyObject * _io__IOBase_writelines(PyObject *self, PyObject *lines) -/*[clinic end generated code: output=976eb0a9b60a6628 input=432e729a8450b3cb]*/ +/*[clinic end generated code: output=976eb0a9b60a6628 input=cac3fc8864183359]*/ { PyObject *iter, *res; From 84785d01d458f2981990aae853992888e5d8b703 Mon Sep 17 00:00:00 2001 From: Marcin Niemira Date: Thu, 4 Apr 2019 19:13:22 +1100 Subject: [PATCH 2/4] update Misc News --- .../next/Documentation/2019-04-04-19-11-47.bpo-36523.sG1Tr4.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Documentation/2019-04-04-19-11-47.bpo-36523.sG1Tr4.rst diff --git a/Misc/NEWS.d/next/Documentation/2019-04-04-19-11-47.bpo-36523.sG1Tr4.rst b/Misc/NEWS.d/next/Documentation/2019-04-04-19-11-47.bpo-36523.sG1Tr4.rst new file mode 100644 index 00000000000000..2f5e3facf30062 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2019-04-04-19-11-47.bpo-36523.sG1Tr4.rst @@ -0,0 +1 @@ +Added Documention for io.IOBase.writelines(). From 8400756ca7fb8d8b4027659487896a1f92abe110 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Fri, 5 Apr 2019 15:28:51 -0400 Subject: [PATCH 3/4] Update 2019-04-04-19-11-47.bpo-36523.sG1Tr4.rst --- .../next/Documentation/2019-04-04-19-11-47.bpo-36523.sG1Tr4.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Documentation/2019-04-04-19-11-47.bpo-36523.sG1Tr4.rst b/Misc/NEWS.d/next/Documentation/2019-04-04-19-11-47.bpo-36523.sG1Tr4.rst index 2f5e3facf30062..9355f607d760ad 100644 --- a/Misc/NEWS.d/next/Documentation/2019-04-04-19-11-47.bpo-36523.sG1Tr4.rst +++ b/Misc/NEWS.d/next/Documentation/2019-04-04-19-11-47.bpo-36523.sG1Tr4.rst @@ -1 +1 @@ -Added Documention for io.IOBase.writelines(). +Add docstring for io.IOBase.writelines(). From a105a89bcdd6612d3f76beabe07b7c2e37ae54b8 Mon Sep 17 00:00:00 2001 From: Marcin Niemira Date: Mon, 22 Apr 2019 20:49:03 +1000 Subject: [PATCH 4/4] add same docstring to _pyio and io writelines method --- Lib/_pyio.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lib/_pyio.py b/Lib/_pyio.py index e868fdc7cbc5c2..af2ce30c278062 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -551,6 +551,11 @@ def readlines(self, hint=None): return lines def writelines(self, lines): + """Write a list of lines to the stream. + + Line separators are not added, so it is usual for each of the lines + provided to have a line separator at the end. + """ self._checkClosed() for line in lines: self.write(line)