summaryrefslogtreecommitdiffstats
path: root/Modules/_io/clinic
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2023-08-22 10:01:38 (GMT)
committerGitHub <noreply@github.com>2023-08-22 10:01:38 (GMT)
commitef4d427fd8ed89fcfb5a0fada4c24abec12991e5 (patch)
tree2daf8f740526f8c518fa7325c10e3c1d0301c392 /Modules/_io/clinic
parentdd73f2f76ab1eabe92a2ca820430be723df31cde (diff)
downloadcpython-ef4d427fd8ed89fcfb5a0fada4c24abec12991e5.zip
cpython-ef4d427fd8ed89fcfb5a0fada4c24abec12991e5.tar.gz
cpython-ef4d427fd8ed89fcfb5a0fada4c24abec12991e5.tar.bz2
[3.12] gh-107801: Improve the accuracy of io.TextIOWrapper.seek docs (#107933) (#108262)
(cherry picked from commit 7f87ebbc3f52680c939791f397b9a478edf0c8d4) Clearly document the supported seek() operations: - Rewind to the start of the stream - Restore a previous stream position (given by tell()) - Fast-forward to the end of the stream
Diffstat (limited to 'Modules/_io/clinic')
-rw-r--r--Modules/_io/clinic/textio.c.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/Modules/_io/clinic/textio.c.h b/Modules/_io/clinic/textio.c.h
index 33fc23b..63ec563 100644
--- a/Modules/_io/clinic/textio.c.h
+++ b/Modules/_io/clinic/textio.c.h
@@ -759,9 +759,27 @@ exit:
}
PyDoc_STRVAR(_io_TextIOWrapper_seek__doc__,
-"seek($self, cookie, whence=0, /)\n"
+"seek($self, cookie, whence=os.SEEK_SET, /)\n"
"--\n"
-"\n");
+"\n"
+"Set the stream position, and return the new stream position.\n"
+"\n"
+" cookie\n"
+" Zero or an opaque number returned by tell().\n"
+" whence\n"
+" The relative position to seek from.\n"
+"\n"
+"Four operations are supported, given by the following argument\n"
+"combinations:\n"
+"\n"
+"- seek(0, SEEK_SET): Rewind to the start of the stream.\n"
+"- seek(cookie, SEEK_SET): Restore a previous position;\n"
+" \'cookie\' must be a number returned by tell().\n"
+"- seek(0, SEEK_END): Fast-forward to the end of the stream.\n"
+"- seek(0, SEEK_CUR): Leave the current stream position unchanged.\n"
+"\n"
+"Any other argument combinations are invalid,\n"
+"and may raise exceptions.");
#define _IO_TEXTIOWRAPPER_SEEK_METHODDEF \
{"seek", _PyCFunction_CAST(_io_TextIOWrapper_seek), METH_FASTCALL, _io_TextIOWrapper_seek__doc__},
@@ -960,4 +978,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
{
return _io_TextIOWrapper_close_impl(self);
}
-/*[clinic end generated code: output=42f592331302973f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=fc02f9e59bfa9956 input=a9049054013a1b77]*/