1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4 
5 PyDoc_STRVAR(_io__BufferedIOBase_readinto__doc__,
6 "readinto($self, buffer, /)\n"
7 "--\n"
8 "\n");
9 
10 #define _IO__BUFFEREDIOBASE_READINTO_METHODDEF    \
11     {"readinto", (PyCFunction)_io__BufferedIOBase_readinto, METH_O, _io__BufferedIOBase_readinto__doc__},
12 
13 static PyObject *
14 _io__BufferedIOBase_readinto_impl(PyObject *self, Py_buffer *buffer);
15 
16 static PyObject *
_io__BufferedIOBase_readinto(PyObject * self,PyObject * arg)17 _io__BufferedIOBase_readinto(PyObject *self, PyObject *arg)
18 {
19     PyObject *return_value = NULL;
20     Py_buffer buffer = {NULL, NULL};
21 
22     if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
23         PyErr_Clear();
24         _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
25         goto exit;
26     }
27     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
28         _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
29         goto exit;
30     }
31     return_value = _io__BufferedIOBase_readinto_impl(self, &buffer);
32 
33 exit:
34     /* Cleanup for buffer */
35     if (buffer.obj) {
36        PyBuffer_Release(&buffer);
37     }
38 
39     return return_value;
40 }
41 
42 PyDoc_STRVAR(_io__BufferedIOBase_readinto1__doc__,
43 "readinto1($self, buffer, /)\n"
44 "--\n"
45 "\n");
46 
47 #define _IO__BUFFEREDIOBASE_READINTO1_METHODDEF    \
48     {"readinto1", (PyCFunction)_io__BufferedIOBase_readinto1, METH_O, _io__BufferedIOBase_readinto1__doc__},
49 
50 static PyObject *
51 _io__BufferedIOBase_readinto1_impl(PyObject *self, Py_buffer *buffer);
52 
53 static PyObject *
_io__BufferedIOBase_readinto1(PyObject * self,PyObject * arg)54 _io__BufferedIOBase_readinto1(PyObject *self, PyObject *arg)
55 {
56     PyObject *return_value = NULL;
57     Py_buffer buffer = {NULL, NULL};
58 
59     if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
60         PyErr_Clear();
61         _PyArg_BadArgument("readinto1", "argument", "read-write bytes-like object", arg);
62         goto exit;
63     }
64     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
65         _PyArg_BadArgument("readinto1", "argument", "contiguous buffer", arg);
66         goto exit;
67     }
68     return_value = _io__BufferedIOBase_readinto1_impl(self, &buffer);
69 
70 exit:
71     /* Cleanup for buffer */
72     if (buffer.obj) {
73        PyBuffer_Release(&buffer);
74     }
75 
76     return return_value;
77 }
78 
79 PyDoc_STRVAR(_io__BufferedIOBase_detach__doc__,
80 "detach($self, /)\n"
81 "--\n"
82 "\n"
83 "Disconnect this buffer from its underlying raw stream and return it.\n"
84 "\n"
85 "After the raw stream has been detached, the buffer is in an unusable\n"
86 "state.");
87 
88 #define _IO__BUFFEREDIOBASE_DETACH_METHODDEF    \
89     {"detach", (PyCFunction)_io__BufferedIOBase_detach, METH_NOARGS, _io__BufferedIOBase_detach__doc__},
90 
91 static PyObject *
92 _io__BufferedIOBase_detach_impl(PyObject *self);
93 
94 static PyObject *
_io__BufferedIOBase_detach(PyObject * self,PyObject * Py_UNUSED (ignored))95 _io__BufferedIOBase_detach(PyObject *self, PyObject *Py_UNUSED(ignored))
96 {
97     return _io__BufferedIOBase_detach_impl(self);
98 }
99 
100 PyDoc_STRVAR(_io__Buffered_peek__doc__,
101 "peek($self, size=0, /)\n"
102 "--\n"
103 "\n");
104 
105 #define _IO__BUFFERED_PEEK_METHODDEF    \
106     {"peek", (PyCFunction)(void(*)(void))_io__Buffered_peek, METH_FASTCALL, _io__Buffered_peek__doc__},
107 
108 static PyObject *
109 _io__Buffered_peek_impl(buffered *self, Py_ssize_t size);
110 
111 static PyObject *
_io__Buffered_peek(buffered * self,PyObject * const * args,Py_ssize_t nargs)112 _io__Buffered_peek(buffered *self, PyObject *const *args, Py_ssize_t nargs)
113 {
114     PyObject *return_value = NULL;
115     Py_ssize_t size = 0;
116 
117     if (!_PyArg_CheckPositional("peek", nargs, 0, 1)) {
118         goto exit;
119     }
120     if (nargs < 1) {
121         goto skip_optional;
122     }
123     if (PyFloat_Check(args[0])) {
124         PyErr_SetString(PyExc_TypeError,
125                         "integer argument expected, got float" );
126         goto exit;
127     }
128     {
129         Py_ssize_t ival = -1;
130         PyObject *iobj = PyNumber_Index(args[0]);
131         if (iobj != NULL) {
132             ival = PyLong_AsSsize_t(iobj);
133             Py_DECREF(iobj);
134         }
135         if (ival == -1 && PyErr_Occurred()) {
136             goto exit;
137         }
138         size = ival;
139     }
140 skip_optional:
141     return_value = _io__Buffered_peek_impl(self, size);
142 
143 exit:
144     return return_value;
145 }
146 
147 PyDoc_STRVAR(_io__Buffered_read__doc__,
148 "read($self, size=-1, /)\n"
149 "--\n"
150 "\n");
151 
152 #define _IO__BUFFERED_READ_METHODDEF    \
153     {"read", (PyCFunction)(void(*)(void))_io__Buffered_read, METH_FASTCALL, _io__Buffered_read__doc__},
154 
155 static PyObject *
156 _io__Buffered_read_impl(buffered *self, Py_ssize_t n);
157 
158 static PyObject *
_io__Buffered_read(buffered * self,PyObject * const * args,Py_ssize_t nargs)159 _io__Buffered_read(buffered *self, PyObject *const *args, Py_ssize_t nargs)
160 {
161     PyObject *return_value = NULL;
162     Py_ssize_t n = -1;
163 
164     if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
165         goto exit;
166     }
167     if (nargs < 1) {
168         goto skip_optional;
169     }
170     if (!_Py_convert_optional_to_ssize_t(args[0], &n)) {
171         goto exit;
172     }
173 skip_optional:
174     return_value = _io__Buffered_read_impl(self, n);
175 
176 exit:
177     return return_value;
178 }
179 
180 PyDoc_STRVAR(_io__Buffered_read1__doc__,
181 "read1($self, size=-1, /)\n"
182 "--\n"
183 "\n");
184 
185 #define _IO__BUFFERED_READ1_METHODDEF    \
186     {"read1", (PyCFunction)(void(*)(void))_io__Buffered_read1, METH_FASTCALL, _io__Buffered_read1__doc__},
187 
188 static PyObject *
189 _io__Buffered_read1_impl(buffered *self, Py_ssize_t n);
190 
191 static PyObject *
_io__Buffered_read1(buffered * self,PyObject * const * args,Py_ssize_t nargs)192 _io__Buffered_read1(buffered *self, PyObject *const *args, Py_ssize_t nargs)
193 {
194     PyObject *return_value = NULL;
195     Py_ssize_t n = -1;
196 
197     if (!_PyArg_CheckPositional("read1", nargs, 0, 1)) {
198         goto exit;
199     }
200     if (nargs < 1) {
201         goto skip_optional;
202     }
203     if (PyFloat_Check(args[0])) {
204         PyErr_SetString(PyExc_TypeError,
205                         "integer argument expected, got float" );
206         goto exit;
207     }
208     {
209         Py_ssize_t ival = -1;
210         PyObject *iobj = PyNumber_Index(args[0]);
211         if (iobj != NULL) {
212             ival = PyLong_AsSsize_t(iobj);
213             Py_DECREF(iobj);
214         }
215         if (ival == -1 && PyErr_Occurred()) {
216             goto exit;
217         }
218         n = ival;
219     }
220 skip_optional:
221     return_value = _io__Buffered_read1_impl(self, n);
222 
223 exit:
224     return return_value;
225 }
226 
227 PyDoc_STRVAR(_io__Buffered_readinto__doc__,
228 "readinto($self, buffer, /)\n"
229 "--\n"
230 "\n");
231 
232 #define _IO__BUFFERED_READINTO_METHODDEF    \
233     {"readinto", (PyCFunction)_io__Buffered_readinto, METH_O, _io__Buffered_readinto__doc__},
234 
235 static PyObject *
236 _io__Buffered_readinto_impl(buffered *self, Py_buffer *buffer);
237 
238 static PyObject *
_io__Buffered_readinto(buffered * self,PyObject * arg)239 _io__Buffered_readinto(buffered *self, PyObject *arg)
240 {
241     PyObject *return_value = NULL;
242     Py_buffer buffer = {NULL, NULL};
243 
244     if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
245         PyErr_Clear();
246         _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
247         goto exit;
248     }
249     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
250         _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
251         goto exit;
252     }
253     return_value = _io__Buffered_readinto_impl(self, &buffer);
254 
255 exit:
256     /* Cleanup for buffer */
257     if (buffer.obj) {
258        PyBuffer_Release(&buffer);
259     }
260 
261     return return_value;
262 }
263 
264 PyDoc_STRVAR(_io__Buffered_readinto1__doc__,
265 "readinto1($self, buffer, /)\n"
266 "--\n"
267 "\n");
268 
269 #define _IO__BUFFERED_READINTO1_METHODDEF    \
270     {"readinto1", (PyCFunction)_io__Buffered_readinto1, METH_O, _io__Buffered_readinto1__doc__},
271 
272 static PyObject *
273 _io__Buffered_readinto1_impl(buffered *self, Py_buffer *buffer);
274 
275 static PyObject *
_io__Buffered_readinto1(buffered * self,PyObject * arg)276 _io__Buffered_readinto1(buffered *self, PyObject *arg)
277 {
278     PyObject *return_value = NULL;
279     Py_buffer buffer = {NULL, NULL};
280 
281     if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
282         PyErr_Clear();
283         _PyArg_BadArgument("readinto1", "argument", "read-write bytes-like object", arg);
284         goto exit;
285     }
286     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
287         _PyArg_BadArgument("readinto1", "argument", "contiguous buffer", arg);
288         goto exit;
289     }
290     return_value = _io__Buffered_readinto1_impl(self, &buffer);
291 
292 exit:
293     /* Cleanup for buffer */
294     if (buffer.obj) {
295        PyBuffer_Release(&buffer);
296     }
297 
298     return return_value;
299 }
300 
301 PyDoc_STRVAR(_io__Buffered_readline__doc__,
302 "readline($self, size=-1, /)\n"
303 "--\n"
304 "\n");
305 
306 #define _IO__BUFFERED_READLINE_METHODDEF    \
307     {"readline", (PyCFunction)(void(*)(void))_io__Buffered_readline, METH_FASTCALL, _io__Buffered_readline__doc__},
308 
309 static PyObject *
310 _io__Buffered_readline_impl(buffered *self, Py_ssize_t size);
311 
312 static PyObject *
_io__Buffered_readline(buffered * self,PyObject * const * args,Py_ssize_t nargs)313 _io__Buffered_readline(buffered *self, PyObject *const *args, Py_ssize_t nargs)
314 {
315     PyObject *return_value = NULL;
316     Py_ssize_t size = -1;
317 
318     if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
319         goto exit;
320     }
321     if (nargs < 1) {
322         goto skip_optional;
323     }
324     if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
325         goto exit;
326     }
327 skip_optional:
328     return_value = _io__Buffered_readline_impl(self, size);
329 
330 exit:
331     return return_value;
332 }
333 
334 PyDoc_STRVAR(_io__Buffered_seek__doc__,
335 "seek($self, target, whence=0, /)\n"
336 "--\n"
337 "\n");
338 
339 #define _IO__BUFFERED_SEEK_METHODDEF    \
340     {"seek", (PyCFunction)(void(*)(void))_io__Buffered_seek, METH_FASTCALL, _io__Buffered_seek__doc__},
341 
342 static PyObject *
343 _io__Buffered_seek_impl(buffered *self, PyObject *targetobj, int whence);
344 
345 static PyObject *
_io__Buffered_seek(buffered * self,PyObject * const * args,Py_ssize_t nargs)346 _io__Buffered_seek(buffered *self, PyObject *const *args, Py_ssize_t nargs)
347 {
348     PyObject *return_value = NULL;
349     PyObject *targetobj;
350     int whence = 0;
351 
352     if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
353         goto exit;
354     }
355     targetobj = args[0];
356     if (nargs < 2) {
357         goto skip_optional;
358     }
359     if (PyFloat_Check(args[1])) {
360         PyErr_SetString(PyExc_TypeError,
361                         "integer argument expected, got float" );
362         goto exit;
363     }
364     whence = _PyLong_AsInt(args[1]);
365     if (whence == -1 && PyErr_Occurred()) {
366         goto exit;
367     }
368 skip_optional:
369     return_value = _io__Buffered_seek_impl(self, targetobj, whence);
370 
371 exit:
372     return return_value;
373 }
374 
375 PyDoc_STRVAR(_io__Buffered_truncate__doc__,
376 "truncate($self, pos=None, /)\n"
377 "--\n"
378 "\n");
379 
380 #define _IO__BUFFERED_TRUNCATE_METHODDEF    \
381     {"truncate", (PyCFunction)(void(*)(void))_io__Buffered_truncate, METH_FASTCALL, _io__Buffered_truncate__doc__},
382 
383 static PyObject *
384 _io__Buffered_truncate_impl(buffered *self, PyObject *pos);
385 
386 static PyObject *
_io__Buffered_truncate(buffered * self,PyObject * const * args,Py_ssize_t nargs)387 _io__Buffered_truncate(buffered *self, PyObject *const *args, Py_ssize_t nargs)
388 {
389     PyObject *return_value = NULL;
390     PyObject *pos = Py_None;
391 
392     if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
393         goto exit;
394     }
395     if (nargs < 1) {
396         goto skip_optional;
397     }
398     pos = args[0];
399 skip_optional:
400     return_value = _io__Buffered_truncate_impl(self, pos);
401 
402 exit:
403     return return_value;
404 }
405 
406 PyDoc_STRVAR(_io_BufferedReader___init____doc__,
407 "BufferedReader(raw, buffer_size=DEFAULT_BUFFER_SIZE)\n"
408 "--\n"
409 "\n"
410 "Create a new buffered reader using the given readable raw IO object.");
411 
412 static int
413 _io_BufferedReader___init___impl(buffered *self, PyObject *raw,
414                                  Py_ssize_t buffer_size);
415 
416 static int
_io_BufferedReader___init__(PyObject * self,PyObject * args,PyObject * kwargs)417 _io_BufferedReader___init__(PyObject *self, PyObject *args, PyObject *kwargs)
418 {
419     int return_value = -1;
420     static const char * const _keywords[] = {"raw", "buffer_size", NULL};
421     static _PyArg_Parser _parser = {NULL, _keywords, "BufferedReader", 0};
422     PyObject *argsbuf[2];
423     PyObject * const *fastargs;
424     Py_ssize_t nargs = PyTuple_GET_SIZE(args);
425     Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
426     PyObject *raw;
427     Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE;
428 
429     fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
430     if (!fastargs) {
431         goto exit;
432     }
433     raw = fastargs[0];
434     if (!noptargs) {
435         goto skip_optional_pos;
436     }
437     if (PyFloat_Check(fastargs[1])) {
438         PyErr_SetString(PyExc_TypeError,
439                         "integer argument expected, got float" );
440         goto exit;
441     }
442     {
443         Py_ssize_t ival = -1;
444         PyObject *iobj = PyNumber_Index(fastargs[1]);
445         if (iobj != NULL) {
446             ival = PyLong_AsSsize_t(iobj);
447             Py_DECREF(iobj);
448         }
449         if (ival == -1 && PyErr_Occurred()) {
450             goto exit;
451         }
452         buffer_size = ival;
453     }
454 skip_optional_pos:
455     return_value = _io_BufferedReader___init___impl((buffered *)self, raw, buffer_size);
456 
457 exit:
458     return return_value;
459 }
460 
461 PyDoc_STRVAR(_io_BufferedWriter___init____doc__,
462 "BufferedWriter(raw, buffer_size=DEFAULT_BUFFER_SIZE)\n"
463 "--\n"
464 "\n"
465 "A buffer for a writeable sequential RawIO object.\n"
466 "\n"
467 "The constructor creates a BufferedWriter for the given writeable raw\n"
468 "stream. If the buffer_size is not given, it defaults to\n"
469 "DEFAULT_BUFFER_SIZE.");
470 
471 static int
472 _io_BufferedWriter___init___impl(buffered *self, PyObject *raw,
473                                  Py_ssize_t buffer_size);
474 
475 static int
_io_BufferedWriter___init__(PyObject * self,PyObject * args,PyObject * kwargs)476 _io_BufferedWriter___init__(PyObject *self, PyObject *args, PyObject *kwargs)
477 {
478     int return_value = -1;
479     static const char * const _keywords[] = {"raw", "buffer_size", NULL};
480     static _PyArg_Parser _parser = {NULL, _keywords, "BufferedWriter", 0};
481     PyObject *argsbuf[2];
482     PyObject * const *fastargs;
483     Py_ssize_t nargs = PyTuple_GET_SIZE(args);
484     Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
485     PyObject *raw;
486     Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE;
487 
488     fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
489     if (!fastargs) {
490         goto exit;
491     }
492     raw = fastargs[0];
493     if (!noptargs) {
494         goto skip_optional_pos;
495     }
496     if (PyFloat_Check(fastargs[1])) {
497         PyErr_SetString(PyExc_TypeError,
498                         "integer argument expected, got float" );
499         goto exit;
500     }
501     {
502         Py_ssize_t ival = -1;
503         PyObject *iobj = PyNumber_Index(fastargs[1]);
504         if (iobj != NULL) {
505             ival = PyLong_AsSsize_t(iobj);
506             Py_DECREF(iobj);
507         }
508         if (ival == -1 && PyErr_Occurred()) {
509             goto exit;
510         }
511         buffer_size = ival;
512     }
513 skip_optional_pos:
514     return_value = _io_BufferedWriter___init___impl((buffered *)self, raw, buffer_size);
515 
516 exit:
517     return return_value;
518 }
519 
520 PyDoc_STRVAR(_io_BufferedWriter_write__doc__,
521 "write($self, buffer, /)\n"
522 "--\n"
523 "\n");
524 
525 #define _IO_BUFFEREDWRITER_WRITE_METHODDEF    \
526     {"write", (PyCFunction)_io_BufferedWriter_write, METH_O, _io_BufferedWriter_write__doc__},
527 
528 static PyObject *
529 _io_BufferedWriter_write_impl(buffered *self, Py_buffer *buffer);
530 
531 static PyObject *
_io_BufferedWriter_write(buffered * self,PyObject * arg)532 _io_BufferedWriter_write(buffered *self, PyObject *arg)
533 {
534     PyObject *return_value = NULL;
535     Py_buffer buffer = {NULL, NULL};
536 
537     if (PyObject_GetBuffer(arg, &buffer, PyBUF_SIMPLE) != 0) {
538         goto exit;
539     }
540     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
541         _PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
542         goto exit;
543     }
544     return_value = _io_BufferedWriter_write_impl(self, &buffer);
545 
546 exit:
547     /* Cleanup for buffer */
548     if (buffer.obj) {
549        PyBuffer_Release(&buffer);
550     }
551 
552     return return_value;
553 }
554 
555 PyDoc_STRVAR(_io_BufferedRWPair___init____doc__,
556 "BufferedRWPair(reader, writer, buffer_size=DEFAULT_BUFFER_SIZE, /)\n"
557 "--\n"
558 "\n"
559 "A buffered reader and writer object together.\n"
560 "\n"
561 "A buffered reader object and buffered writer object put together to\n"
562 "form a sequential IO object that can read and write. This is typically\n"
563 "used with a socket or two-way pipe.\n"
564 "\n"
565 "reader and writer are RawIOBase objects that are readable and\n"
566 "writeable respectively. If the buffer_size is omitted it defaults to\n"
567 "DEFAULT_BUFFER_SIZE.");
568 
569 static int
570 _io_BufferedRWPair___init___impl(rwpair *self, PyObject *reader,
571                                  PyObject *writer, Py_ssize_t buffer_size);
572 
573 static int
_io_BufferedRWPair___init__(PyObject * self,PyObject * args,PyObject * kwargs)574 _io_BufferedRWPair___init__(PyObject *self, PyObject *args, PyObject *kwargs)
575 {
576     int return_value = -1;
577     PyObject *reader;
578     PyObject *writer;
579     Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE;
580 
581     if ((Py_TYPE(self) == &PyBufferedRWPair_Type) &&
582         !_PyArg_NoKeywords("BufferedRWPair", kwargs)) {
583         goto exit;
584     }
585     if (!_PyArg_CheckPositional("BufferedRWPair", PyTuple_GET_SIZE(args), 2, 3)) {
586         goto exit;
587     }
588     reader = PyTuple_GET_ITEM(args, 0);
589     writer = PyTuple_GET_ITEM(args, 1);
590     if (PyTuple_GET_SIZE(args) < 3) {
591         goto skip_optional;
592     }
593     if (PyFloat_Check(PyTuple_GET_ITEM(args, 2))) {
594         PyErr_SetString(PyExc_TypeError,
595                         "integer argument expected, got float" );
596         goto exit;
597     }
598     {
599         Py_ssize_t ival = -1;
600         PyObject *iobj = PyNumber_Index(PyTuple_GET_ITEM(args, 2));
601         if (iobj != NULL) {
602             ival = PyLong_AsSsize_t(iobj);
603             Py_DECREF(iobj);
604         }
605         if (ival == -1 && PyErr_Occurred()) {
606             goto exit;
607         }
608         buffer_size = ival;
609     }
610 skip_optional:
611     return_value = _io_BufferedRWPair___init___impl((rwpair *)self, reader, writer, buffer_size);
612 
613 exit:
614     return return_value;
615 }
616 
617 PyDoc_STRVAR(_io_BufferedRandom___init____doc__,
618 "BufferedRandom(raw, buffer_size=DEFAULT_BUFFER_SIZE)\n"
619 "--\n"
620 "\n"
621 "A buffered interface to random access streams.\n"
622 "\n"
623 "The constructor creates a reader and writer for a seekable stream,\n"
624 "raw, given in the first argument. If the buffer_size is omitted it\n"
625 "defaults to DEFAULT_BUFFER_SIZE.");
626 
627 static int
628 _io_BufferedRandom___init___impl(buffered *self, PyObject *raw,
629                                  Py_ssize_t buffer_size);
630 
631 static int
_io_BufferedRandom___init__(PyObject * self,PyObject * args,PyObject * kwargs)632 _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
633 {
634     int return_value = -1;
635     static const char * const _keywords[] = {"raw", "buffer_size", NULL};
636     static _PyArg_Parser _parser = {NULL, _keywords, "BufferedRandom", 0};
637     PyObject *argsbuf[2];
638     PyObject * const *fastargs;
639     Py_ssize_t nargs = PyTuple_GET_SIZE(args);
640     Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
641     PyObject *raw;
642     Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE;
643 
644     fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
645     if (!fastargs) {
646         goto exit;
647     }
648     raw = fastargs[0];
649     if (!noptargs) {
650         goto skip_optional_pos;
651     }
652     if (PyFloat_Check(fastargs[1])) {
653         PyErr_SetString(PyExc_TypeError,
654                         "integer argument expected, got float" );
655         goto exit;
656     }
657     {
658         Py_ssize_t ival = -1;
659         PyObject *iobj = PyNumber_Index(fastargs[1]);
660         if (iobj != NULL) {
661             ival = PyLong_AsSsize_t(iobj);
662             Py_DECREF(iobj);
663         }
664         if (ival == -1 && PyErr_Occurred()) {
665             goto exit;
666         }
667         buffer_size = ival;
668     }
669 skip_optional_pos:
670     return_value = _io_BufferedRandom___init___impl((buffered *)self, raw, buffer_size);
671 
672 exit:
673     return return_value;
674 }
675 /*[clinic end generated code: output=7246104f6c7d3167 input=a9049054013a1b77]*/
676