summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
authorVladimir Marangozov <vladimir.marangozov@t-online.de>2000-08-18 18:01:06 (GMT)
committerVladimir Marangozov <vladimir.marangozov@t-online.de>2000-08-18 18:01:06 (GMT)
commit0888ff17bd745333dc61a0e4bb3afb399f007c3f (patch)
treea1c85cc9b8e67658356860be9607259974b3f0db /Python/errors.c
parent8ae9ce5e5b40f0e2fc809a08dbbede5079c7b8e7 (diff)
downloadcpython-0888ff17bd745333dc61a0e4bb3afb399f007c3f.zip
cpython-0888ff17bd745333dc61a0e4bb3afb399f007c3f.tar.gz
cpython-0888ff17bd745333dc61a0e4bb3afb399f007c3f.tar.bz2
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 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);