Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ab86521

Browse files
n0npaxmethane
authored andcommitted
bpo-36523: Add docstring to io.IOBase.writelines (GH-12683)
1 parent 662ebd2 commit ab86521

4 files changed

Lines changed: 18 additions & 3 deletions

File tree

Lib/_pyio.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,11 @@ def readlines(self, hint=None):
551551
return lines
552552

553553
def writelines(self, lines):
554+
"""Write a list of lines to the stream.
555+
556+
Line separators are not added, so it is usual for each of the lines
557+
provided to have a line separator at the end.
558+
"""
554559
self._checkClosed()
555560
for line in lines:
556561
self.write(line)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add docstring for io.IOBase.writelines().

Modules/_io/clinic/iobase.c.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,11 @@ _io__IOBase_readlines(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
242242
PyDoc_STRVAR(_io__IOBase_writelines__doc__,
243243
"writelines($self, lines, /)\n"
244244
"--\n"
245-
"\n");
245+
"\n"
246+
"Write a list of lines to stream.\n"
247+
"\n"
248+
"Line separators are not added, so it is usual for each of the\n"
249+
"lines provided to have a line separator at the end.");
246250

247251
#define _IO__IOBASE_WRITELINES_METHODDEF \
248252
{"writelines", (PyCFunction)_io__IOBase_writelines, METH_O, _io__IOBase_writelines__doc__},
@@ -311,4 +315,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored))
311315
{
312316
return _io__RawIOBase_readall_impl(self);
313317
}
314-
/*[clinic end generated code: output=60e43a7cbd9f314e input=a9049054013a1b77]*/
318+
/*[clinic end generated code: output=61b6ea7153ef9940 input=a9049054013a1b77]*/

Modules/_io/iobase.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,11 +751,16 @@ _io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint)
751751
_io._IOBase.writelines
752752
lines: object
753753
/
754+
755+
Write a list of lines to stream.
756+
757+
Line separators are not added, so it is usual for each of the
758+
lines provided to have a line separator at the end.
754759
[clinic start generated code]*/
755760

756761
static PyObject *
757762
_io__IOBase_writelines(PyObject *self, PyObject *lines)
758-
/*[clinic end generated code: output=976eb0a9b60a6628 input=432e729a8450b3cb]*/
763+
/*[clinic end generated code: output=976eb0a9b60a6628 input=cac3fc8864183359]*/
759764
{
760765
PyObject *iter, *res;
761766

0 commit comments

Comments
 (0)