@@ -115,70 +115,99 @@ bufferediobase_unsupported(_PyIO_State *state, const char *message)
115
115
/*[clinic input]
116
116
_io._BufferedIOBase.detach
117
117
118
+ cls: defining_class
119
+ /
120
+
118
121
Disconnect this buffer from its underlying raw stream and return it.
119
122
120
123
After the raw stream has been detached, the buffer is in an unusable
121
124
state.
122
125
[clinic start generated code]*/
123
126
124
127
static PyObject *
125
- _io__BufferedIOBase_detach_impl (PyObject * self )
126
- /*[clinic end generated code: output=754977c8d10ed88c input=822427fb58fe4169 ]*/
128
+ _io__BufferedIOBase_detach_impl (PyObject * self , PyTypeObject * cls )
129
+ /*[clinic end generated code: output=b87b135d67cd4448 input=0b61a7b4357c1ea7 ]*/
127
130
{
128
131
_PyIO_State * state = IO_STATE ();
129
132
return bufferediobase_unsupported (state , "detach" );
130
133
}
131
134
132
- PyDoc_STRVAR (bufferediobase_read_doc ,
133
- "Read and return up to n bytes.\n"
134
- "\n"
135
- "If the argument is omitted, None, or negative, reads and\n"
136
- "returns all data until EOF.\n"
137
- "\n"
138
- "If the argument is positive, and the underlying raw stream is\n"
139
- "not 'interactive', multiple raw reads may be issued to satisfy\n"
140
- "the byte count (unless EOF is reached first). But for\n"
141
- "interactive raw streams (as well as sockets and pipes), at most\n"
142
- "one raw read will be issued, and a short result does not imply\n"
143
- "that EOF is imminent.\n"
144
- "\n"
145
- "Returns an empty bytes object on EOF.\n"
146
- "\n"
147
- "Returns None if the underlying raw stream was open in non-blocking\n"
148
- "mode and no data is available at the moment.\n" );
135
+ /*[clinic input]
136
+ _io._BufferedIOBase.read
137
+
138
+ cls: defining_class
139
+ /
140
+ *args: object
141
+
142
+ Read and return up to n bytes.
143
+
144
+ If the argument is omitted, None, or negative, read and
145
+ return all data until EOF.
146
+
147
+ If the argument is positive, and the underlying raw stream is
148
+ not 'interactive', multiple raw reads may be issued to satisfy
149
+ the byte count (unless EOF is reached first).
150
+ However, for interactive raw streams (as well as sockets and pipes),
151
+ at most one raw read will be issued, and a short result does not
152
+ imply that EOF is imminent.
153
+
154
+ Return an empty bytes object on EOF.
155
+
156
+ Return None if the underlying raw stream was open in non-blocking
157
+ mode and no data is available at the moment.
158
+ [clinic start generated code]*/
149
159
150
160
static PyObject *
151
- bufferediobase_read (PyObject * self , PyObject * args )
161
+ _io__BufferedIOBase_read_impl (PyObject * self , PyTypeObject * cls ,
162
+ PyObject * args )
163
+ /*[clinic end generated code: output=4521b30940fd7b67 input=390205758adc8510]*/
152
164
{
153
165
_PyIO_State * state = IO_STATE ();
154
166
return bufferediobase_unsupported (state , "read" );
155
167
}
156
168
157
- PyDoc_STRVAR (bufferediobase_read1_doc ,
158
- "Read and return up to n bytes, with at most one read() call\n"
159
- "to the underlying raw stream. A short result does not imply\n"
160
- "that EOF is imminent.\n"
161
- "\n"
162
- "Returns an empty bytes object on EOF.\n" );
169
+ /*[clinic input]
170
+ _io._BufferedIOBase.read1
171
+
172
+ cls: defining_class
173
+ /
174
+ *args: object
175
+
176
+ Read and return up to n bytes, with at most one read() call to the underlying raw stream.
177
+
178
+ Return an empty bytes object on EOF.
179
+ A short result does not imply that EOF is imminent.
180
+ [clinic start generated code]*/
163
181
164
182
static PyObject *
165
- bufferediobase_read1 (PyObject * self , PyObject * args )
183
+ _io__BufferedIOBase_read1_impl (PyObject * self , PyTypeObject * cls ,
184
+ PyObject * args )
185
+ /*[clinic end generated code: output=636fd241c21e050a input=ef546a1238c5b41c]*/
166
186
{
167
187
_PyIO_State * state = IO_STATE ();
168
188
return bufferediobase_unsupported (state , "read1" );
169
189
}
170
190
171
- PyDoc_STRVAR (bufferediobase_write_doc ,
172
- "Write the given buffer to the IO stream.\n"
173
- "\n"
174
- "Returns the number of bytes written, which is always the length of b\n"
175
- "in bytes.\n"
176
- "\n"
177
- "Raises BlockingIOError if the buffer is full and the\n"
178
- "underlying raw stream cannot accept more data at the moment.\n" );
191
+ /*[clinic input]
192
+ _io._BufferedIOBase.write
193
+
194
+ cls: defining_class
195
+ /
196
+ *args: object
197
+
198
+ Write the given buffer to the IO stream.
199
+
200
+ Return the number of bytes written, which is always
201
+ the length of b in bytes.
202
+
203
+ Raise BlockingIOError if the buffer is full and the
204
+ underlying raw stream cannot accept more data at the moment.
205
+ [clinic start generated code]*/
179
206
180
207
static PyObject *
181
- bufferediobase_write (PyObject * self , PyObject * args )
208
+ _io__BufferedIOBase_write_impl (PyObject * self , PyTypeObject * cls ,
209
+ PyObject * args )
210
+ /*[clinic end generated code: output=d51feea4bcac9892 input=f79b72c4dccb3dc2]*/
182
211
{
183
212
_PyIO_State * state = IO_STATE ();
184
213
return bufferediobase_unsupported (state , "write" );
@@ -2336,11 +2365,11 @@ _io_BufferedRandom___init___impl(buffered *self, PyObject *raw,
2336
2365
2337
2366
static PyMethodDef bufferediobase_methods [] = {
2338
2367
_IO__BUFFEREDIOBASE_DETACH_METHODDEF
2339
- { "read" , bufferediobase_read , METH_VARARGS , bufferediobase_read_doc },
2340
- { "read1" , bufferediobase_read1 , METH_VARARGS , bufferediobase_read1_doc },
2368
+ _IO__BUFFEREDIOBASE_READ_METHODDEF
2369
+ _IO__BUFFEREDIOBASE_READ1_METHODDEF
2341
2370
_IO__BUFFEREDIOBASE_READINTO_METHODDEF
2342
2371
_IO__BUFFEREDIOBASE_READINTO1_METHODDEF
2343
- { "write" , bufferediobase_write , METH_VARARGS , bufferediobase_write_doc },
2372
+ _IO__BUFFEREDIOBASE_WRITE_METHODDEF
2344
2373
{NULL , NULL }
2345
2374
};
2346
2375
0 commit comments