Skip to content

gh-101819: Fix _io clinic input for unused base class method stubs #104418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 15, 2023
Merged
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
26 changes: 13 additions & 13 deletions Modules/_io/bufferedio.c
Original file line number Diff line number Diff line change
@@ -136,15 +136,15 @@ _io__BufferedIOBase_detach_impl(PyObject *self, PyTypeObject *cls)
_io._BufferedIOBase.read
cls: defining_class
size: int(unused=True) = -1
/
*args: object
Read and return up to n bytes.
If the argument is omitted, None, or negative, read and
If the size argument is omitted, None, or negative, read and
return all data until EOF.
If the argument is positive, and the underlying raw stream is
If the size argument is positive, and the underlying raw stream is
not 'interactive', multiple raw reads may be issued to satisfy
the byte count (unless EOF is reached first).
However, for interactive raw streams (as well as sockets and pipes),
@@ -159,8 +159,8 @@ mode and no data is available at the moment.

static PyObject *
_io__BufferedIOBase_read_impl(PyObject *self, PyTypeObject *cls,
PyObject *args)
/*[clinic end generated code: output=4521b30940fd7b67 input=390205758adc8510]*/
int Py_UNUSED(size))
/*[clinic end generated code: output=aceb2765587b0a29 input=824f6f910465e61a]*/
{
_PyIO_State *state = get_io_state_by_cls(cls);
return bufferediobase_unsupported(state, "read");
@@ -170,19 +170,19 @@ _io__BufferedIOBase_read_impl(PyObject *self, PyTypeObject *cls,
_io._BufferedIOBase.read1
cls: defining_class
size: int(unused=True) = -1
/
*args: object
Read and return up to n bytes, with at most one read() call to the underlying raw stream.
Read and return up to size bytes, with at most one read() call to the underlying raw stream.
Return an empty bytes object on EOF.
A short result does not imply that EOF is imminent.
[clinic start generated code]*/

static PyObject *
_io__BufferedIOBase_read1_impl(PyObject *self, PyTypeObject *cls,
PyObject *args)
/*[clinic end generated code: output=636fd241c21e050a input=ef546a1238c5b41c]*/
int Py_UNUSED(size))
/*[clinic end generated code: output=2e7fc62972487eaa input=af76380e020fd9e6]*/
{
_PyIO_State *state = get_io_state_by_cls(cls);
return bufferediobase_unsupported(state, "read1");
@@ -192,10 +192,10 @@ _io__BufferedIOBase_read1_impl(PyObject *self, PyTypeObject *cls,
_io._BufferedIOBase.write
cls: defining_class
b: object(unused=True)
/
*args: object
Write the given buffer to the IO stream.
Write buffer b to the IO stream.
Return the number of bytes written, which is always
the length of b in bytes.
@@ -206,8 +206,8 @@ underlying raw stream cannot accept more data at the moment.

static PyObject *
_io__BufferedIOBase_write_impl(PyObject *self, PyTypeObject *cls,
PyObject *args)
/*[clinic end generated code: output=d51feea4bcac9892 input=f79b72c4dccb3dc2]*/
PyObject *Py_UNUSED(b))
/*[clinic end generated code: output=712c635246bf2306 input=9793f5c8f71029ad]*/
{
_PyIO_State *state = get_io_state_by_cls(cls);
return bufferediobase_unsupported(state, "write");
69 changes: 40 additions & 29 deletions Modules/_io/clinic/bufferedio.c.h

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

58 changes: 37 additions & 21 deletions Modules/_io/clinic/iobase.c.h

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

80 changes: 53 additions & 27 deletions Modules/_io/clinic/textio.c.h

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

21 changes: 12 additions & 9 deletions Modules/_io/iobase.c
Original file line number Diff line number Diff line change
@@ -82,24 +82,26 @@ iobase_unsupported(_PyIO_State *state, const char *message)
/*[clinic input]
_io._IOBase.seek
cls: defining_class
offset: int(unused=True)
whence: int(unused=True, c_default='0') = os.SEEK_SET
/
*args: object
Change the stream position to the given byte offset.
The offset is interpreted relative to the position indicated by whence.
Values for whence are:
* 0 -- start of stream (the default); offset should be zero or positive
* 1 -- current stream position; offset may be negative
* 2 -- end of stream; offset is usually negative
* os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
* os.SEEK_CUR or 1 -- current stream position; offset may be negative
* os.SEEK_END or 2 -- end of stream; offset is usually negative
Return the new absolute position.
[clinic start generated code]*/

static PyObject *
_io__IOBase_seek_impl(PyObject *self, PyTypeObject *cls, PyObject *args)
/*[clinic end generated code: output=1dd694ac9de260fa input=ebb5476eb22fc5d4]*/
_io__IOBase_seek_impl(PyObject *self, PyTypeObject *cls,
int Py_UNUSED(offset), int Py_UNUSED(whence))
/*[clinic end generated code: output=8bd74ea6538ded53 input=8d4e6adcd08292f2]*/
{
_PyIO_State *state = get_io_state_by_cls(cls);
return iobase_unsupported(state, "seek");
@@ -121,8 +123,8 @@ _io__IOBase_tell_impl(PyObject *self)
/*[clinic input]
_io._IOBase.truncate
cls: defining_class
size: object(unused=True) = None
/
*args: object
Truncate file to size bytes.
@@ -131,8 +133,9 @@ as reported by tell(). Return the new size.
[clinic start generated code]*/

static PyObject *
_io__IOBase_truncate_impl(PyObject *self, PyTypeObject *cls, PyObject *args)
/*[clinic end generated code: output=b7eed4649cbe22c1 input=ad90582a1d8b5cc9]*/
_io__IOBase_truncate_impl(PyObject *self, PyTypeObject *cls,
PyObject *Py_UNUSED(size))
/*[clinic end generated code: output=2013179bff1fe8ef input=660ac20936612c27]*/
{
_PyIO_State *state = get_io_state_by_cls(cls);
return iobase_unsupported(state, "truncate");
23 changes: 13 additions & 10 deletions Modules/_io/textio.c
Original file line number Diff line number Diff line change
@@ -69,8 +69,8 @@ _io__TextIOBase_detach_impl(PyObject *self, PyTypeObject *cls)
/*[clinic input]
_io._TextIOBase.read
cls: defining_class
size: int(unused=True) = -1
/
*args: object
Read at most size characters from stream.
@@ -79,8 +79,9 @@ If size is negative or omitted, read until EOF.
[clinic start generated code]*/

static PyObject *
_io__TextIOBase_read_impl(PyObject *self, PyTypeObject *cls, PyObject *args)
/*[clinic end generated code: output=3adf28998831f461 input=cee1e84664a20de0]*/
_io__TextIOBase_read_impl(PyObject *self, PyTypeObject *cls,
int Py_UNUSED(size))
/*[clinic end generated code: output=51a5178a309ce647 input=f5e37720f9fc563f]*/
{
_PyIO_State *state = get_io_state_by_cls(cls);
return _unsupported(state, "read");
@@ -89,18 +90,19 @@ _io__TextIOBase_read_impl(PyObject *self, PyTypeObject *cls, PyObject *args)
/*[clinic input]
_io._TextIOBase.readline
cls: defining_class
size: int(unused=True) = -1
/
*args: object
Read until newline or EOF.
Return an empty string if EOF is hit immediately.
If size is specified, at most size characters will be read.
[clinic start generated code]*/

static PyObject *
_io__TextIOBase_readline_impl(PyObject *self, PyTypeObject *cls,
PyObject *args)
/*[clinic end generated code: output=3073a948d02319f3 input=58f801259f7ff3ef]*/
int Py_UNUSED(size))
/*[clinic end generated code: output=3f47d7966d6d074e input=42eafec94107fa27]*/
{
_PyIO_State *state = get_io_state_by_cls(cls);
return _unsupported(state, "readline");
@@ -109,18 +111,19 @@ _io__TextIOBase_readline_impl(PyObject *self, PyTypeObject *cls,
/*[clinic input]
_io._TextIOBase.write
cls: defining_class
s: str(unused=True)
/
*args: object
Write string to stream.
Write string s to stream.
Return the number of characters written
(which is always equal to the length of the string).
[clinic start generated code]*/

static PyObject *
_io__TextIOBase_write_impl(PyObject *self, PyTypeObject *cls, PyObject *args)
/*[clinic end generated code: output=5d985eb529472bc4 input=21b6961b5cba9496]*/
_io__TextIOBase_write_impl(PyObject *self, PyTypeObject *cls,
const char *Py_UNUSED(s))
/*[clinic end generated code: output=18b28231460275de input=e9cabaa5f6732b07]*/
{
_PyIO_State *state = get_io_state_by_cls(cls);
return _unsupported(state, "write");