@@ -8,13 +8,6 @@ class _io.BytesIO "bytesio *" "&PyBytesIO_Type"
88[clinic start generated code]*/
99/*[clinic end generated code: output=da39a3ee5e6b4b0d input=7f50ec034f5c0b26]*/
1010
11- /*[python input]
12- class io_ssize_t_converter(CConverter):
13- type = 'Py_ssize_t'
14- converter = '_PyIO_ConvertSsize_t'
15- [python start generated code]*/
16- /*[python end generated code: output=da39a3ee5e6b4b0d input=d0a811d3cbfd1b33]*/
17-
1811typedef struct {
1912 PyObject_HEAD
2013 PyObject * buf ;
@@ -381,7 +374,7 @@ read_bytes(bytesio *self, Py_ssize_t size)
381374
382375/*[clinic input]
383376_io.BytesIO.read
384- size: io_ssize_t = -1
377+ size: Py_ssize_t(accept={int, NoneType}) = -1
385378 /
386379
387380Read at most size bytes, returned as a bytes object.
@@ -392,7 +385,7 @@ Return an empty bytes object at EOF.
392385
393386static PyObject *
394387_io_BytesIO_read_impl (bytesio * self , Py_ssize_t size )
395- /*[clinic end generated code: output=9cc025f21c75bdd2 input=c81ec53b8f2cc3cf ]*/
388+ /*[clinic end generated code: output=9cc025f21c75bdd2 input=74344a39f431c3d7 ]*/
396389{
397390 Py_ssize_t n ;
398391
@@ -412,7 +405,7 @@ _io_BytesIO_read_impl(bytesio *self, Py_ssize_t size)
412405
413406/*[clinic input]
414407_io.BytesIO.read1
415- size: io_ssize_t = -1
408+ size: Py_ssize_t(accept={int, NoneType}) = -1
416409 /
417410
418411Read at most size bytes, returned as a bytes object.
@@ -423,14 +416,14 @@ Return an empty bytes object at EOF.
423416
424417static PyObject *
425418_io_BytesIO_read1_impl (bytesio * self , Py_ssize_t size )
426- /*[clinic end generated code: output=d0f843285aa95f1c input=67cf18b142111664 ]*/
419+ /*[clinic end generated code: output=d0f843285aa95f1c input=440a395bf9129ef5 ]*/
427420{
428421 return _io_BytesIO_read_impl (self , size );
429422}
430423
431424/*[clinic input]
432425_io.BytesIO.readline
433- size: io_ssize_t = -1
426+ size: Py_ssize_t(accept={int, NoneType}) = -1
434427 /
435428
436429Next line from the file, as a bytes object.
@@ -442,7 +435,7 @@ Return an empty bytes object at EOF.
442435
443436static PyObject *
444437_io_BytesIO_readline_impl (bytesio * self , Py_ssize_t size )
445- /*[clinic end generated code: output=4bff3c251df8ffcd input=7c95bd3f9e9d1646 ]*/
438+ /*[clinic end generated code: output=4bff3c251df8ffcd input=e7c3fbd1744e2783 ]*/
446439{
447440 Py_ssize_t n ;
448441
@@ -556,7 +549,7 @@ _io_BytesIO_readinto_impl(bytesio *self, Py_buffer *buffer)
556549
557550/*[clinic input]
558551_io.BytesIO.truncate
559- size as arg: object = None
552+ size: Py_ssize_t(accept={int, NoneType}, c_default="self->pos") = None
560553 /
561554
562555Truncate the file to at most size bytes.
@@ -566,31 +559,12 @@ The current file position is unchanged. Returns the new size.
566559[clinic start generated code]*/
567560
568561static PyObject *
569- _io_BytesIO_truncate_impl (bytesio * self , PyObject * arg )
570- /*[clinic end generated code: output=81e6be60e67ddd66 input=11ed1966835462ba ]*/
562+ _io_BytesIO_truncate_impl (bytesio * self , Py_ssize_t size )
563+ /*[clinic end generated code: output=9ad17650c15fa09b input=423759dd42d2f7c1 ]*/
571564{
572- Py_ssize_t size ;
573-
574565 CHECK_CLOSED (self );
575566 CHECK_EXPORTS (self );
576567
577- if (arg == Py_None ) {
578- /* Truncate to current position if no argument is passed. */
579- size = self -> pos ;
580- }
581- else if (PyIndex_Check (arg )) {
582- size = PyNumber_AsSsize_t (arg , PyExc_OverflowError );
583- if (size == -1 && PyErr_Occurred ()) {
584- return NULL ;
585- }
586- }
587- else {
588- PyErr_Format (PyExc_TypeError ,
589- "argument should be integer or None, not '%.200s'" ,
590- Py_TYPE (arg )-> tp_name );
591- return NULL ;
592- }
593-
594568 if (size < 0 ) {
595569 PyErr_Format (PyExc_ValueError ,
596570 "negative size value %zd" , size );
0 commit comments