summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-10-28 22:56:58 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-10-28 22:56:58 (GMT)
commit07e20ef50b52d2359213bc5d91f809a76cfd1524 (patch)
tree74803fa7efe3959104b0d9760e4cff172e5c3919 /Python/errors.c
parent1842d0c4d88fffb5bea53b410acb77796b66bc8b (diff)
downloadcpython-07e20ef50b52d2359213bc5d91f809a76cfd1524.zip
cpython-07e20ef50b52d2359213bc5d91f809a76cfd1524.tar.gz
cpython-07e20ef50b52d2359213bc5d91f809a76cfd1524.tar.bz2
Issue #5437: A preallocated MemoryError instance should not hold traceback
data (including local variables caught in the stack trace) alive infinitely.
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 0490614..d5a6fae 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -333,29 +333,7 @@ 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)
- {
- /* 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
- */
- PyErr_SetNone(PyExc_MemoryError);
-
+ PyErr_SetNone(PyExc_MemoryError);
return NULL;
}