From 0888ff17bd745333dc61a0e4bb3afb399f007c3f Mon Sep 17 00:00:00 2001 From: Vladimir Marangozov Date: Fri, 18 Aug 2000 18:01:06 +0000 Subject: [PATCH] Do not set a MemoryError exception over another MemoryError exception, thus preserving the first one that has been raised. --- Python/errors.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Python/errors.c b/Python/errors.c index a9e4daed9b..ffa7f82f34 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); -- 2.40.0