]> granicus.if.org Git - python/commitdiff
bpo-36523: Add docstring to io.IOBase.writelines (GH-12683)
authorMarcin Niemira <marcin.niemira@gmail.com>
Mon, 22 Apr 2019 11:13:51 +0000 (21:13 +1000)
committerInada Naoki <songofacandy@gmail.com>
Mon, 22 Apr 2019 11:13:51 +0000 (20:13 +0900)
Lib/_pyio.py
Misc/NEWS.d/next/Documentation/2019-04-04-19-11-47.bpo-36523.sG1Tr4.rst [new file with mode: 0644]
Modules/_io/clinic/iobase.c.h
Modules/_io/iobase.c

index e868fdc7cbc5c2b4e6b2c81e1c346d7e8061ec6e..af2ce30c27806234499c20d3df30e9b9db7f491d 100644 (file)
@@ -551,6 +551,11 @@ class IOBase(metaclass=abc.ABCMeta):
         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)
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 (file)
index 0000000..9355f60
--- /dev/null
@@ -0,0 +1 @@
+Add docstring for io.IOBase.writelines().
index a5c8eea3ec3aed41374912dbd1bfb0fd8af00e81..ddaff7b5d135d8c7f0e1c0dc55dc10ef473f4b5f 100644 (file)
@@ -242,7 +242,11 @@ exit:
 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]*/
index 3a8f16ae0b6589689d9dc910ff2b28e8a743a69d..6a0d9bec5af3205716e4e6602e71dbe17a470b2e 100644 (file)
@@ -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;