diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-08-08 16:54:58 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-08-08 16:54:58 (GMT) |
commit | 4e7f2852520a3a417608f21d0172d16300b3979f (patch) | |
tree | ac99b7c8a62e762267b98e96763317c3fd380205 /Modules/pyexpat.c | |
parent | 37d3d9aa9692da71d2d66b90d60baa593456a880 (diff) | |
download | cpython-4e7f2852520a3a417608f21d0172d16300b3979f.zip cpython-4e7f2852520a3a417608f21d0172d16300b3979f.tar.gz cpython-4e7f2852520a3a417608f21d0172d16300b3979f.tar.bz2 |
remove dead code #9292
Diffstat (limited to 'Modules/pyexpat.c')
-rw-r--r-- | Modules/pyexpat.c | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index 20af5ed..1653432 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -855,18 +855,15 @@ static PyObject * xmlparse_ParseFile(xmlparseobject *self, PyObject *f) { int rv = 1; - FILE *fp; PyObject *readmethod = NULL; - { - fp = NULL; - readmethod = PyObject_GetAttrString(f, "read"); - if (readmethod == NULL) { - PyErr_Clear(); - PyErr_SetString(PyExc_TypeError, - "argument must have 'read' attribute"); - return NULL; - } + + readmethod = PyObject_GetAttrString(f, "read"); + if (readmethod == NULL) { + PyErr_Clear(); + PyErr_SetString(PyExc_TypeError, + "argument must have 'read' attribute"); + return NULL; } for (;;) { int bytes_read; @@ -876,19 +873,10 @@ xmlparse_ParseFile(xmlparseobject *self, PyObject *f) return PyErr_NoMemory(); } - if (fp) { - bytes_read = fread(buf, sizeof(char), BUF_SIZE, fp); - if (bytes_read < 0) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - } - else { - bytes_read = readinst(buf, BUF_SIZE, readmethod); - if (bytes_read < 0) { - Py_DECREF(readmethod); - return NULL; - } + bytes_read = readinst(buf, BUF_SIZE, readmethod); + if (bytes_read < 0) { + Py_DECREF(readmethod); + return NULL; } rv = XML_ParseBuffer(self->itself, bytes_read, bytes_read == 0); if (PyErr_Occurred()) { |