summaryrefslogtreecommitdiff
path: root/Python/errors.c
diff options
context:
space:
mode:
authorVladimir Marangozov <vladimir.marangozov@t-online.de>2000-08-18 18:01:06 +0000
committerVladimir Marangozov <vladimir.marangozov@t-online.de>2000-08-18 18:01:06 +0000
commitd2c3db25693992b3d4af025b86ddf03a9092b2b5 (patch)
tree63714e93cca6e2919f310c1e3499861388e495ac /Python/errors.c
parenteb11f6ed95cab5f8937f86897aeb6ef513b59fb4 (diff)
downloadcpython-d2c3db25693992b3d4af025b86ddf03a9092b2b5.tar.gz
Do not set a MemoryError exception over another MemoryError exception,
thus preserving the first one that has been raised.
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c4
1 files changed, 4 insertions, 0 deletions
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);