8000 gh-101819: Adapt _io._Buffered* methods to Argument Clinic by erlend-aasland · Pull Request #104367 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-101819: Adapt _io._Buffered* methods to Argument Clinic #104367

8000 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 11, 2023
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
Add defining class to _io._Buffered.truncate and use it to fetch state
  • Loading branch information
erlend-aasland committed May 10, 2023
commit 329b0a6ef1038412311f48ef76ae792da67bb914
7 changes: 4 additions & 3 deletions Modules/_io/bufferedio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1379,20 +1379,21 @@ _io__Buffered_seek_impl(buffered *self, PyObject *targetobj, int whence)

/*[clinic input]
_io._Buffered.truncate
cls: defining_class
pos: object = None
/
[clinic start generated code]*/

static PyObject *
_io__Buffered_truncate_impl(buffered *self, PyObject *pos)
/*[clinic end generated code: output=667ca03c60c270de input=8a1be34d57cca2d3]*/
_io__Buffered_truncate_impl(buffered *self, PyTypeObject *cls, PyObject *pos)
/*[clinic end generated code: output=fe3882fbffe79f1a input=f5b737d97d76303f]*/
{
PyObject *res = NULL;

CHECK_INITIALIZED(self)
CHECK_CLOSED(self, "truncate of closed file")
if (!self->writable) {
_PyIO_State *state = IO_STATE();
_PyIO_State *state = get_io_state_by_cls(cls);
return bufferediobase_unsupported(state, "truncate");
}
if (!ENTER_BUFFERED(self))
Expand Down
31 changes: 23 additions & 8 deletions Modules/_io/clinic/bufferedio.c.h

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

0