]> granicus.if.org Git - python/commitdiff
Do not set a MemoryError exception over another MemoryError exception,
authorVladimir Marangozov <vladimir.marangozov@t-online.de>
Fri, 18 Aug 2000 18:01:06 +0000 (18:01 +0000)
committerVladimir Marangozov <vladimir.marangozov@t-online.de>
Fri, 18 Aug 2000 18:01:06 +0000 (18:01 +0000)
thus preserving the first one that has been raised.

Python/errors.c

index a9e4daed9b536e61e7809d78ae77d312d0fa9fd3..ffa7f82f345d115c28bf7c981cefd764839b76d9 100644 (file)
@@ -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);