File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -855,18 +855,15 @@ static PyObject *
855855xmlparse_ParseFile (xmlparseobject * self , PyObject * f )
856856{
857857 int rv = 1 ;
858- FILE * fp ;
859858 PyObject * readmethod = NULL ;
860859
861- {
862- fp = NULL ;
863- readmethod = PyObject_GetAttrString (f , "read" );
864- if (readmethod == NULL ) {
865- PyErr_Clear ();
866- PyErr_SetString (PyExc_TypeError ,
867- "argument must have 'read' attribute" );
868- return NULL ;
869- }
860+
861+ readmethod = PyObject_GetAttrString (f , "read" );
862+ if (readmethod == NULL ) {
863+ PyErr_Clear ();
864+ PyErr_SetString (PyExc_TypeError ,
865+ "argument must have 'read' attribute" );
866+ return NULL ;
870867 }
871868 for (;;) {
872869 int bytes_read ;
@@ -876,19 +873,10 @@ xmlparse_ParseFile(xmlparseobject *self, PyObject *f)
876873 return PyErr_NoMemory ();
877874 }
878875
879- if (fp ) {
880- bytes_read = fread (buf , sizeof (char ), BUF_SIZE , fp );
881- if (bytes_read < 0 ) {
882- PyErr_SetFromErrno (PyExc_IOError );
883- return NULL ;
884- }
885- }
886- else {
887- bytes_read = readinst (buf , BUF_SIZE , readmethod );
888- if (bytes_read < 0 ) {
889- Py_DECREF (readmethod );
890- return NULL ;
891- }
876+ bytes_read = readinst (buf , BUF_SIZE , readmethod );
877+ if (bytes_read < 0 ) {
878+ Py_DECREF (readmethod );
879+ return NULL ;
892880 }
893881 rv = XML_ParseBuffer (self -> itself , bytes_read , bytes_read == 0 );
894882 if (PyErr_Occurred ()) {
You can’t perform that action at this time.
0 commit comments