Skip to content

Commit b997d8c

Browse files
committed
Make pyexpat always use PyFile's as if they're objects
pyexpat made a check if PyFile_Check(), and if was a real file, would use a local fread() call to speed things up. With /MT, that's unsupported. Only side effect should be marginally slower.
1 parent a7f9e6d commit b997d8c

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

Modules/pyexpat.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -964,11 +964,12 @@ xmlparse_ParseFile(xmlparseobject *self, PyObject *f)
964964
int rv = 1;
965965
FILE *fp;
966966
PyObject *readmethod = NULL;
967-
968-
if (PyFile_Check(f)) {
969-
fp = PyFile_AsFile(f);
970-
}
971-
else {
967+
// BEGIN_PYSCR_CHANGE davegb3 06-Feb-2011 FixMTBuild
968+
// if (PyFile_Check(f)) {
969+
// fp = PyFile_AsFile(f);
970+
// }
971+
// else {
972+
// END_PYSCR_CHANGE
972973
fp = NULL;
973974
readmethod = PyObject_GetAttrString(f, "read");
974975
if (readmethod == NULL) {
@@ -977,7 +978,9 @@ xmlparse_ParseFile(xmlparseobject *self, PyObject *f)
977978
"argument must have 'read' attribute");
978979
return NULL;
979980
}
980-
}
981+
// BEGIN_PYSCR_CHANGE davegb3 06-Feb-2011 FixMTBuild
982+
// }
983+
// END_PYSCR_CHANGE
981984
for (;;) {
982985
int bytes_read;
983986
void *buf = XML_GetBuffer(self->itself, BUF_SIZE);

0 commit comments

Comments
 (0)