mirror of
https://github.com/python/cpython.git
synced 2025-11-07 21:29:26 +00:00
remove dead code #9292
This commit is contained in:
parent
37d3d9aa96
commit
4e7f285252
1 changed files with 11 additions and 23 deletions
|
|
@ -855,11 +855,9 @@ static PyObject *
|
||||||
xmlparse_ParseFile(xmlparseobject *self, PyObject *f)
|
xmlparse_ParseFile(xmlparseobject *self, PyObject *f)
|
||||||
{
|
{
|
||||||
int rv = 1;
|
int rv = 1;
|
||||||
FILE *fp;
|
|
||||||
PyObject *readmethod = NULL;
|
PyObject *readmethod = NULL;
|
||||||
|
|
||||||
{
|
|
||||||
fp = NULL;
|
|
||||||
readmethod = PyObject_GetAttrString(f, "read");
|
readmethod = PyObject_GetAttrString(f, "read");
|
||||||
if (readmethod == NULL) {
|
if (readmethod == NULL) {
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
|
|
@ -867,7 +865,6 @@ xmlparse_ParseFile(xmlparseobject *self, PyObject *f)
|
||||||
"argument must have 'read' attribute");
|
"argument must have 'read' attribute");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
void *buf = XML_GetBuffer(self->itself, BUF_SIZE);
|
void *buf = XML_GetBuffer(self->itself, BUF_SIZE);
|
||||||
|
|
@ -876,20 +873,11 @@ xmlparse_ParseFile(xmlparseobject *self, PyObject *f)
|
||||||
return PyErr_NoMemory();
|
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);
|
bytes_read = readinst(buf, BUF_SIZE, readmethod);
|
||||||
if (bytes_read < 0) {
|
if (bytes_read < 0) {
|
||||||
Py_DECREF(readmethod);
|
Py_DECREF(readmethod);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
rv = XML_ParseBuffer(self->itself, bytes_read, bytes_read == 0);
|
rv = XML_ParseBuffer(self->itself, bytes_read, bytes_read == 0);
|
||||||
if (PyErr_Occurred()) {
|
if (PyErr_Occurred()) {
|
||||||
Py_XDECREF(readmethod);
|
Py_XDECREF(readmethod);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue