Do not set a MemoryError exception over another MemoryError exception,
thus preserving the first one that has been raised.
diff --git a/Python/errors.c b/Python/errors.c
index a9e4dae..ffa7f82 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -238,6 +238,10 @@
PyObject *
PyErr_NoMemory(void)
{
+ if (PyErr_ExceptionMatches(PyExc_MemoryError))
+ /* already current */
+ return NULL;
+
/* raise the pre-allocated instance if it still exists */
if (PyExc_MemoryErrorInst)
PyErr_SetObject(PyExc_MemoryError, PyExc_MemoryErrorInst);