mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
Correct one of the "MemoryError oddities":
the traceback would grow each time a MemoryError is raised.
This commit is contained in:
parent
a986dfa927
commit
e19cadb427
2 changed files with 28 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue