summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Python/errors.c4
1 files changed, 4 insertions, 0 deletions
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 @@ PyErr_BadArgument(void)
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);