Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add missing *args
  • Loading branch information
erlend-aasland committed May 10, 2023
commit 34c3e990247b1311a617109735b2670cb139c24b
24 changes: 16 additions & 8 deletions Modules/_io/bufferedio.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ _io._BufferedIOBase.detach

cls: defining_class
/
*args: object

Disconnect this buffer from its underlying raw stream and return it.

Expand All @@ -125,8 +126,9 @@ state.
[clinic start generated code]*/

static PyObject *
_io__BufferedIOBase_detach_impl(PyObject *self, PyTypeObject *cls)
/*[clinic end generated code: output=b87b135d67cd4448 input=0b61a7b4357c1ea7]*/
_io__BufferedIOBase_detach_impl(PyObject *self, PyTypeObject *cls,
PyObject *args)
/*[clinic end generated code: output=f713c93ded3dd685 input=fb1ce27699f480eb]*/
{
_PyIO_State *state = IO_STATE();
return bufferediobase_unsupported(state, "detach");
Expand All @@ -137,6 +139,7 @@ _io._BufferedIOBase.read

cls: defining_class
Comment thread
erlend-aasland marked this conversation as resolved.
/
*args: object
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the signature is wrong and should be fixed. It should have 1 optional positional argument, maybe called size. Look at other read() functions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I did think about that. I also think AC should be able to attach Py_UNUSED to unused arguments (I'm working on that.) I'll create a follow-up PR for fixing the clinic input. (This is not the only problematic usage of *args in _io.)


Read and return up to n bytes.

Expand All @@ -157,8 +160,9 @@ mode and no data is available at the moment.
[clinic start generated code]*/

static PyObject *
_io__BufferedIOBase_read_impl(PyObject *self, PyTypeObject *cls)
/*[clinic end generated code: output=905b1b6ea25c0aa5 input=52e347baff1c191c]*/
_io__BufferedIOBase_read_impl(PyObject *self, PyTypeObject *cls,
PyObject *args)
/*[clinic end generated code: output=4521b30940fd7b67 input=7e26b448274234a0]*/
{
_PyIO_State *state = IO_STATE();
return bufferediobase_unsupported(state, "read");
Expand All @@ -169,6 +173,7 @@ _io._BufferedIOBase.read1

cls: defining_class
Comment thread
erlend-aasland marked this conversation as resolved.
/
*args: object

Read and return up to n bytes, with at most one read() call to the underlying raw stream.

Expand All @@ -177,8 +182,9 @@ A short result does not imply that EOF is imminent.
[clinic start generated code]*/

static PyObject *
_io__BufferedIOBase_read1_impl(PyObject *self, PyTypeObject *cls)
/*[clinic end generated code: output=999785c4a78817bf input=c38f07e1be5ee79d]*/
_io__BufferedIOBase_read1_impl(PyObject *self, PyTypeObject *cls,
PyObject *args)
/*[clinic end generated code: output=636fd241c21e050a input=ef546a1238c5b41c]*/
{
_PyIO_State *state = IO_STATE();
return bufferediobase_unsupported(state, "read1");
Expand All @@ -189,6 +195,7 @@ _io._BufferedIOBase.write

cls: defining_class
Comment thread
erlend-aasland marked this conversation as resolved.
/
*args: object

Write the given buffer to the IO stream.

Expand All @@ -200,8 +207,9 @@ underlying raw stream cannot accept more data at the moment.
[clinic start generated code]*/

static PyObject *
_io__BufferedIOBase_write_impl(PyObject *self, PyTypeObject *cls)
/*[clinic end generated code: output=be944cf83e6f7356 input=02b37c30f28e4882]*/
_io__BufferedIOBase_write_impl(PyObject *self, PyTypeObject *cls,
PyObject *args)
/*[clinic end generated code: output=d51feea4bcac9892 input=f79b72c4dccb3dc2]*/
{
_PyIO_State *state = IO_STATE();
return bufferediobase_unsupported(state, "write");
Expand Down
142 changes: 117 additions & 25 deletions Modules/_io/clinic/bufferedio.c.h

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