Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Doc/library/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,9 @@ I/O Base Classes

.. method:: seek(offset, whence=os.SEEK_SET, /)

Change the stream position to the given byte *offset*,
Change the stream position to the given *offset*,
treated as a byte offset for binary streams
and a character offset for text streams,
interpreted relative to the position indicated by *whence*,
and return the new absolute position.
Values for *whence* are:
Expand Down
7 changes: 5 additions & 2 deletions Modules/_io/clinic/iobase.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Modules/_io/iobase.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ _io._IOBase.seek
The relative position to seek from.
/

Change the stream position to the given byte offset.
Change the stream position to the given offset.

The offset is treated as a byte offset for binary streams, and as a
character offset for text streams.

The offset is interpreted relative to the position indicated by whence.
Values for whence are:
Expand All @@ -112,7 +115,7 @@ Return the new absolute position.
static PyObject *
_io__IOBase_seek_impl(PyObject *self, PyTypeObject *cls,
int Py_UNUSED(offset), int Py_UNUSED(whence))
/*[clinic end generated code: output=8bd74ea6538ded53 input=74211232b363363e]*/
/*[clinic end generated code: output=8bd74ea6538ded53 input=2e7053a15733b5d6]*/
{
_PyIO_State *state = get_io_state_by_cls(cls);
return iobase_unsupported(state, "seek");
Expand Down