@@ -24,7 +24,6 @@ _Py_IDENTIFIER(read);
2424_Py_IDENTIFIER (read1 );
2525_Py_IDENTIFIER (readable );
2626_Py_IDENTIFIER (readinto );
27- _Py_IDENTIFIER (readinto1 );
2827_Py_IDENTIFIER (writable );
2928_Py_IDENTIFIER (write );
3029
@@ -48,21 +47,17 @@ PyDoc_STRVAR(bufferediobase_doc,
4847 );
4948
5049static PyObject *
51- _bufferediobase_readinto_generic (PyObject * self , PyObject * args , char readinto1 )
50+ bufferediobase_readinto (PyObject * self , PyObject * args )
5251{
5352 Py_buffer buf ;
5453 Py_ssize_t len ;
5554 PyObject * data ;
5655
57- if (!PyArg_ParseTuple (args ,
58- readinto1 ? "w*:readinto1" : "w*:readinto" ,
59- & buf )) {
56+ if (!PyArg_ParseTuple (args , "w*:readinto" , & buf )) {
6057 return NULL ;
6158 }
6259
63- data = _PyObject_CallMethodId (self ,
64- readinto1 ? & PyId_read1 : & PyId_read ,
65- "n" , buf .len );
60+ data = _PyObject_CallMethodId (self , & PyId_read , "n" , buf .len );
6661 if (data == NULL )
6762 goto error ;
6863
@@ -93,18 +88,6 @@ _bufferediobase_readinto_generic(PyObject *self, PyObject *args, char readinto1)
9388 return NULL ;
9489}
9590
96- static PyObject *
97- bufferediobase_readinto (PyObject * self , PyObject * args )
98- {
99- return _bufferediobase_readinto_generic (self , args , 0 );
100- }
101-
102- static PyObject *
103- bufferediobase_readinto1 (PyObject * self , PyObject * args )
104- {
105- return _bufferediobase_readinto_generic (self , args , 1 );
106- }
107-
10891static PyObject *
10992bufferediobase_unsupported (const char * message )
11093{
@@ -184,7 +167,6 @@ static PyMethodDef bufferediobase_methods[] = {
184167 {"read" , bufferediobase_read , METH_VARARGS , bufferediobase_read_doc },
185168 {"read1" , bufferediobase_read1 , METH_VARARGS , bufferediobase_read1_doc },
186169 {"readinto" , bufferediobase_readinto , METH_VARARGS , NULL },
187- {"readinto1" , bufferediobase_readinto1 , METH_VARARGS , NULL },
188170 {"write" , bufferediobase_write , METH_VARARGS , bufferediobase_write_doc },
189171 {NULL , NULL }
190172};
@@ -1006,17 +988,15 @@ buffered_read1(buffered *self, PyObject *args)
1006988}
1007989
1008990static PyObject *
1009- _buffered_readinto_generic (buffered * self , PyObject * args , char readinto1 )
991+ buffered_readinto (buffered * self , PyObject * args )
1010992{
1011993 Py_buffer buf ;
1012994 Py_ssize_t n , written = 0 , remaining ;
1013995 PyObject * res = NULL ;
1014996
1015997 CHECK_INITIALIZED (self )
1016998
1017- if (!PyArg_ParseTuple (args ,
1018- readinto1 ? "w * :readinto1 " : "w*:readinto" ,
1019- & buf ))
999+ if (!PyArg_ParseTuple (args , "w * :readinto ", & buf ))
10201000 return NULL ;
10211001
10221002 n = Py_SAFE_DOWNCAST (READAHEAD (self ), Py_off_t , Py_ssize_t );
@@ -1054,10 +1034,7 @@ _buffered_readinto_generic(buffered *self, PyObject *args, char readinto1)
10541034 n = _bufferedreader_raw_read (self , (char * ) buf .buf + written ,
10551035 remaining );
10561036 }
1057-
1058- /* In readinto1 mode, we do not want to fill the internal
1059- buffer if we already have some data to return */
1060- else if (!(readinto1 && written )) {
1037+ else {
10611038 n = _bufferedreader_fill_buffer (self );
10621039 if (n > 0 ) {
10631040 if (n > remaining )
@@ -1068,10 +1045,6 @@ _buffered_readinto_generic(buffered *self, PyObject *args, char readinto1)
10681045 continue ; /* short circuit */
10691046 }
10701047 }
1071- else {
1072- n = 0 ;
1073- }
1074-
10751048 if (n == 0 || (n == -2 && written > 0 ))
10761049 break ;
10771050 if (n < 0 ) {
@@ -1081,12 +1054,6 @@ _buffered_readinto_generic(buffered *self, PyObject *args, char readinto1)
10811054 }
10821055 goto end ;
10831056 }
1084-
1085- /* At most one read in readinto1 mode */
1086- if (readinto1 ) {
1087- written += n ;
1088- break ;
1089- }
10901057 }
10911058 res = PyLong_FromSsize_t (written );
10921059
@@ -1097,19 +1064,6 @@ _buffered_readinto_generic(buffered *self, PyObject *args, char readinto1)
10971064 return res ;
10981065}
10991066
1100- static PyObject *
1101- buffered_readinto (buffered * self , PyObject * args )
1102- {
1103- return _buffered_readinto_generic (self , args , 0 );
1104- }
1105-
1106- static PyObject *
1107- buffered_readinto1 (buffered * self , PyObject * args )
1108- {
1109- return _buffered_readinto_generic (self , args , 1 );
1110- }
1111-
1112-
11131067static PyObject *
11141068_buffered_readline (buffered * self , Py_ssize_t limit )
11151069{
@@ -1795,7 +1749,6 @@ static PyMethodDef bufferedreader_methods[] = {
17951749 {"peek" , (PyCFunction )buffered_peek , METH_VARARGS },
17961750 {"read1" , (PyCFunction )buffered_read1 , METH_VARARGS },
17971751 {"readinto" , (PyCFunction )buffered_readinto , METH_VARARGS },
1798- {"readinto1" , (PyCFunction )buffered_readinto1 , METH_VARARGS },
17991752 {"readline" , (PyCFunction )buffered_readline , METH_VARARGS },
18001753 {"seek" , (PyCFunction )buffered_seek , METH_VARARGS },
18011754 {"tell" , (PyCFunction )buffered_tell , METH_NOARGS },
@@ -2394,12 +2347,6 @@ bufferedrwpair_readinto(rwpair *self, PyObject *args)
23942347 return _forward_call (self -> reader , & PyId_readinto , args );
23952348}
23962349
2397- static PyObject *
2398- bufferedrwpair_readinto1 (rwpair * self , PyObject * args )
2399- {
2400- return _forward_call (self -> reader , & PyId_readinto1 , args );
2401- }
2402-
24032350static PyObject *
24042351bufferedrwpair_write (rwpair * self , PyObject * args )
24052352{
@@ -2465,7 +2412,6 @@ static PyMethodDef bufferedrwpair_methods[] = {
24652412 {"peek" , (PyCFunction )bufferedrwpair_peek , METH_VARARGS },
24662413 {"read1" , (PyCFunction )bufferedrwpair_read1 , METH_VARARGS },
24672414 {"readinto" , (PyCFunction )bufferedrwpair_readinto , METH_VARARGS },
2468- {"readinto1" , (PyCFunction )bufferedrwpair_readinto1 , METH_VARARGS },
24692415
24702416 {"write" , (PyCFunction )bufferedrwpair_write , METH_VARARGS },
24712417 {"flush" , (PyCFunction )bufferedrwpair_flush , METH_NOARGS },
@@ -2614,7 +2560,6 @@ static PyMethodDef bufferedrandom_methods[] = {
26142560 {"read" , (PyCFunction )buffered_read , METH_VARARGS },
26152561 {"read1" , (PyCFunction )buffered_read1 , METH_VARARGS },
26162562 {"readinto" , (PyCFunction )buffered_readinto , METH_VARARGS },
2617- {"readinto1" , (PyCFunction )buffered_readinto1 , METH_VARARGS },
26182563 {"readline" , (PyCFunction )buffered_readline , METH_VARARGS },
26192564 {"peek" , (PyCFunction )buffered_peek , METH_VARARGS },
26202565 {"write" , (PyCFunction )bufferedwriter_write , METH_VARARGS },
0 commit comments