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
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.