Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e7f285

Browse files
committed
remove dead code #9292
1 parent 37d3d9a commit 4e7f285

1 file changed

Lines changed: 11 additions & 23 deletions

File tree

Modules/pyexpat.c

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -855,18 +855,15 @@ static PyObject *
855855
xmlparse_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()) {

0 commit comments

Comments
 (0)