Kaydet (Commit) ab86521a authored tarafından Marcin Niemira's avatar Marcin Niemira Kaydeden (comit) Inada Naoki

bpo-36523: Add docstring to io.IOBase.writelines (GH-12683)

üst 662ebd2a
...@@ -551,6 +551,11 @@ class IOBase(metaclass=abc.ABCMeta): ...@@ -551,6 +551,11 @@ class IOBase(metaclass=abc.ABCMeta):
return lines return lines
def writelines(self, 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() self._checkClosed()
for line in lines: for line in lines:
self.write(line) self.write(line)
......
...@@ -242,7 +242,11 @@ exit: ...@@ -242,7 +242,11 @@ exit:
PyDoc_STRVAR(_io__IOBase_writelines__doc__, PyDoc_STRVAR(_io__IOBase_writelines__doc__,
"writelines($self, lines, /)\n" "writelines($self, lines, /)\n"
"--\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 \ #define _IO__IOBASE_WRITELINES_METHODDEF \
{"writelines", (PyCFunction)_io__IOBase_writelines, METH_O, _io__IOBase_writelines__doc__}, {"writelines", (PyCFunction)_io__IOBase_writelines, METH_O, _io__IOBase_writelines__doc__},
...@@ -311,4 +315,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored)) ...@@ -311,4 +315,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored))
{ {
return _io__RawIOBase_readall_impl(self); return _io__RawIOBase_readall_impl(self);
} }
/*[clinic end generated code: output=60e43a7cbd9f314e input=a9049054013a1b77]*/ /*[clinic end generated code: output=61b6ea7153ef9940 input=a9049054013a1b77]*/
...@@ -751,11 +751,16 @@ _io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint) ...@@ -751,11 +751,16 @@ _io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint)
_io._IOBase.writelines _io._IOBase.writelines
lines: object 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]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_io__IOBase_writelines(PyObject *self, PyObject *lines) _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; PyObject *iter, *res;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment