Issue #6676: Ensure a meaningful exception is raised when attempting
to parse more than one XML document per pyexpat xmlparser instance.
(Original patches by Hirokazu Yamamoto and Amaury Forgeot d'Arc, with
suggested wording by David Gutteridge)
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index 8de3fb1..a95c388 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -976,7 +976,7 @@
void *buf = XML_GetBuffer(self->itself, BUF_SIZE);
if (buf == NULL) {
Py_XDECREF(readmethod);
- return PyErr_NoMemory();
+ return get_parse_result(self, 0);
}
bytes_read = readinst(buf, BUF_SIZE, readmethod);