summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-31 22:56:02 +0000
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-31 22:56:02 +0000
commit51b23c9d1183dd91746bccaae0908d5d99548917 (patch)
tree511fe22018036f3b34a90e2f38747bce66b85bda /Python
parenta308b1d832c670e951849fa87ae685dd1dd372fd (diff)
downloadcpython-51b23c9d1183dd91746bccaae0908d5d99548917.tar.gz
Correct one of the "MemoryError oddities":
the traceback would grow each time a MemoryError is raised.
Diffstat (limited to 'Python')
-rw-r--r--Python/errors.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/errors.c b/Python/errors.c
index a06ec02d9a..5ee6255a2a 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -321,7 +321,17 @@ PyErr_NoMemory(void)
/* raise the pre-allocated instance if it still exists */
if (PyExc_MemoryErrorInst)
+ {
+ /* Clear the previous traceback, otherwise it will be appended
+ * to the current one.
+ *
+ * The following statement is not likely to raise any error;
+ * if it does, we simply discard it.
+ */
+ PyException_SetTraceback(PyExc_MemoryErrorInst, Py_None);
+
PyErr_SetObject(PyExc_MemoryError, PyExc_MemoryErrorInst);
+ }
else
/* this will probably fail since there's no memory and hee,
hee, we have to instantiate this class