diff options
author | Erlend E. Aasland <erlend@python.org> | 2023-08-29 19:13:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-29 19:13:38 (GMT) |
commit | 8178a88bd81edae87d6974483e4de9b32e808797 (patch) | |
tree | b0d693c1ae0b344ab722ce790ca059535eac4892 /Modules | |
parent | 59e46932c8d2dc6fe84a8cf144dde962838c0204 (diff) | |
download | cpython-8178a88bd81edae87d6974483e4de9b32e808797.zip cpython-8178a88bd81edae87d6974483e4de9b32e808797.tar.gz cpython-8178a88bd81edae87d6974483e4de9b32e808797.tar.bz2 |
gh-107801: Improve the accuracy of io.IOBase.seek docs (#108268)
- Add param docstrings
- Link to os.SEEK_* constants
- Mention the return value in the initial paragraph
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_io/clinic/iobase.c.h | 7 | ||||
-rw-r--r-- | Modules/_io/iobase.c | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/Modules/_io/clinic/iobase.c.h b/Modules/_io/clinic/iobase.c.h index f582b9d..fb96ea1 100644 --- a/Modules/_io/clinic/iobase.c.h +++ b/Modules/_io/clinic/iobase.c.h @@ -15,6 +15,11 @@ PyDoc_STRVAR(_io__IOBase_seek__doc__, "\n" "Change the stream position to the given byte offset.\n" "\n" +" offset\n" +" The stream position, relative to \'whence\'.\n" +" whence\n" +" The relative position to seek from.\n" +"\n" "The offset is interpreted relative to the position indicated by whence.\n" "Values for whence are:\n" "\n" @@ -437,4 +442,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored)) { return _io__RawIOBase_readall_impl(self); } -/*[clinic end generated code: output=ec741e0961671a86 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=d96f5bfd72e6eafb input=a9049054013a1b77]*/ diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c index 5fd1989..55508a2 100644 --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -83,7 +83,9 @@ iobase_unsupported(_PyIO_State *state, const char *message) _io._IOBase.seek cls: defining_class offset: int(unused=True) + The stream position, relative to 'whence'. whence: int(unused=True, c_default='0') = os.SEEK_SET + The relative position to seek from. / Change the stream position to the given byte offset. @@ -101,7 +103,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=8d4e6adcd08292f2]*/ +/*[clinic end generated code: output=8bd74ea6538ded53 input=74211232b363363e]*/ { _PyIO_State *state = get_io_state_by_cls(cls); return iobase_unsupported(state, "seek"); |