@@ -79,21 +79,27 @@ iobase_unsupported(_PyIO_State *state, const char *message)
79
79
80
80
/* Positioning */
81
81
82
- PyDoc_STRVAR (iobase_seek_doc ,
83
- "Change stream position.\n"
84
- "\n"
85
- "Change the stream position to the given byte offset. The offset is\n"
86
- "interpreted relative to the position indicated by whence. Values\n"
87
- "for whence are:\n"
88
- "\n"
89
- "* 0 -- start of stream (the default); offset should be zero or positive\n"
90
- "* 1 -- current stream position; offset may be negative\n"
91
- "* 2 -- end of stream; offset is usually negative\n"
92
- "\n"
93
- "Return the new absolute position." );
82
+ /*[clinic input]
83
+ _io._IOBase.seek
84
+ cls: defining_class
85
+ /
86
+ *args: object
87
+
88
+ Change the stream position to the given byte offset.
89
+
90
+ The offset is interpreted relative to the position indicated by whence.
91
+ Values for whence are:
92
+
93
+ * 0 -- start of stream (the default); offset should be zero or positive
94
+ * 1 -- current stream position; offset may be negative
95
+ * 2 -- end of stream; offset is usually negative
96
+
97
+ Return the new absolute position.
98
+ [clinic start generated code]*/
94
99
95
100
static PyObject *
96
- iobase_seek (PyObject * self , PyObject * args )
101
+ _io__IOBase_seek_impl (PyObject * self , PyTypeObject * cls , PyObject * args )
102
+ /*[clinic end generated code: output=1dd694ac9de260fa input=ebb5476eb22fc5d4]*/
97
103
{
98
104
_PyIO_State * state = IO_STATE ();
99
105
return iobase_unsupported (state , "seek" );
@@ -112,14 +118,21 @@ _io__IOBase_tell_impl(PyObject *self)
112
118
return _PyObject_CallMethod (self , & _Py_ID (seek ), "ii" , 0 , 1 );
113
119
}
114
120
115
- PyDoc_STRVAR (iobase_truncate_doc ,
116
- "Truncate file to size bytes.\n"
117
- "\n"
118
- "File pointer is left unchanged. Size defaults to the current IO\n"
119
- "position as reported by tell(). Returns the new size." );
121
+ /*[clinic input]
122
+ _io._IOBase.truncate
123
+ cls: defining_class
124
+ /
125
+ *args: object
126
+
127
+ Truncate file to size bytes.
128
+
129
+ File pointer is left unchanged. Size defaults to the current IO position
130
+ as reported by tell(). Return the new size.
131
+ [clinic start generated code]*/
120
132
121
133
static PyObject *
122
- iobase_truncate (PyObject * self , PyObject * args )
134
+ _io__IOBase_truncate_impl (PyObject * self , PyTypeObject * cls , PyObject * args )
135
+ /*[clinic end generated code: output=b7eed4649cbe22c1 input=ad90582a1d8b5cc9]*/
123
136
{
124
137
_PyIO_State * state = IO_STATE ();
125
138
return iobase_unsupported (state , "truncate" );
@@ -809,9 +822,9 @@ _io__IOBase_writelines(PyObject *self, PyObject *lines)
809
822
#include "clinic/iobase.c.h"
810
823
811
824
static PyMethodDef iobase_methods [] = {
812
- { "seek" , iobase_seek , METH_VARARGS , iobase_seek_doc },
825
+ _IO__IOBASE_SEEK_METHODDEF
813
826
_IO__IOBASE_TELL_METHODDEF
814
- { "truncate" , iobase_truncate , METH_VARARGS , iobase_truncate_doc },
827
+ _IO__IOBASE_TRUNCATE_METHODDEF
815
828
_IO__IOBASE_FLUSH_METHODDEF
816
829
_IO__IOBASE_CLOSE_METHODDEF
817
830
0 commit comments