@@ -969,67 +969,57 @@ _io_StringIO___setstate___impl(stringio *self, PyObject *state)
969
969
970
970
971
971
static PyObject *
972
- stringio_closed (stringio * self , void * context )
972
+ stringio_closed_impl (stringio * self , void * context )
973
973
{
974
- PyObject * result = NULL ;
974
+ CHECK_INITIALIZED (self );
975
+ return PyBool_FromLong (self -> closed );
976
+ }
975
977
978
+ static PyObject *
979
+ stringio_closed (stringio * self , void * context )
980
+ {
981
+ PyObject * result ;
976
982
Py_BEGIN_CRITICAL_SECTION (self );
977
- if (self -> ok <= 0 ) {
978
- PyErr_SetString (PyExc_ValueError ,
979
- "I/O operation on uninitialized object" );
980
- goto exit ;
981
- };
982
- result = PyBool_FromLong (self -> closed );
983
-
984
- exit :
983
+ result = stringio_closed_impl (self , context );
985
984
Py_END_CRITICAL_SECTION ();
986
985
return result ;
987
986
}
988
987
989
988
static PyObject *
990
- stringio_line_buffering (stringio * self , void * context )
989
+ stringio_line_buffering_impl (stringio * self , void * context )
991
990
{
992
- PyObject * result = NULL ;
991
+ CHECK_INITIALIZED (self );
992
+ CHECK_CLOSED (self );
993
+ Py_RETURN_FALSE ;
994
+ }
993
995
996
+ static PyObject *
997
+ stringio_line_buffering (stringio * self , void * context )
998
+ {
999
+ PyObject * result ;
994
1000
Py_BEGIN_CRITICAL_SECTION (self );
995
- if (self -> ok <= 0 ) {
996
- PyErr_SetString (PyExc_ValueError ,
997
- "I/O operation on uninitialized object" );
998
- goto exit ;
999
- };
1000
- if (self -> closed ) {
1001
- PyErr_SetString (PyExc_ValueError , "I/O operation on closed file" );
1002
- goto exit ;
1003
- };
1004
- result = Py_NewRef (Py_False );
1005
-
1006
- exit :
1001
+ result = stringio_line_buffering_impl (self , context );
1007
1002
Py_END_CRITICAL_SECTION ();
1008
1003
return result ;
1009
1004
}
1010
1005
1011
1006
static PyObject *
1012
- stringio_newlines (stringio * self , void * context )
1007
+ stringio_newlines_impl (stringio * self , void * context )
1013
1008
{
1014
- PyObject * result = NULL ;
1015
-
1016
- Py_BEGIN_CRITICAL_SECTION (self );
1017
- if (self -> ok <= 0 ) {
1018
- PyErr_SetString (PyExc_ValueError ,
1019
- "I/O operation on uninitialized object" );
1020
- goto exit ;
1021
- };
1022
- if (self -> closed ) {
1023
- PyErr_SetString (PyExc_ValueError , "I/O operation on closed file" );
1024
- goto exit ;
1025
- };
1009
+ CHECK_INITIALIZED (self );
1010
+ CHECK_CLOSED (self );
1026
1011
if (self -> decoder == NULL ) {
1027
- result = Py_NewRef (Py_None );
1028
- goto exit ;
1012
+ Py_RETURN_NONE ;
1029
1013
}
1030
- result = PyObject_GetAttr (self -> decoder , & _Py_ID (newlines ));
1014
+ return PyObject_GetAttr (self -> decoder , & _Py_ID (newlines ));
1015
+ }
1031
1016
1032
- exit :
1017
+ static PyObject *
1018
+ stringio_newlines (stringio * self , void * context )
1019
+ {
1020
+ PyObject * result ;
1021
+ Py_BEGIN_CRITICAL_SECTION (self );
1022
+ result = stringio_newlines_impl (self , context );
1033
1023
Py_END_CRITICAL_SECTION ();
1034
1024
return result ;
1035
1025
}
0 commit comments