Mercurial > cpython-lru_cache-weakref
diff Python/errors.c @ 65688:1b7a0385c65f
Issue #5437: A preallocated MemoryError instance should not hold traceback
data (including local variables caught in the stack trace) alive infinitely.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Thu, 28 Oct 2010 22:56:58 +0000 |
| parents | 39b9e9de372b |
| children | 5605f6920b63 |
line wrap: on
line diff
--- a/Python/errors.c Thu Oct 28 20:13:52 2010 +0000 +++ b/Python/errors.c Thu Oct 28 22:56:58 2010 +0000 @@ -333,29 +333,7 @@ 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; }
