Do not set a MemoryError exception over another MemoryError exception,

thus preserving the first one that has been raised.
This commit is contained in:
Vladimir Marangozov 2000-08-18 18:01:06 +00:00
parent 8ae9ce5e5b
commit 0888ff17bd

View File

@ -238,6 +238,10 @@ PyErr_BadArgument(void)
PyObject * PyObject *
PyErr_NoMemory(void) PyErr_NoMemory(void)
{ {
if (PyErr_ExceptionMatches(PyExc_MemoryError))
/* already current */
return NULL;
/* raise the pre-allocated instance if it still exists */ /* raise the pre-allocated instance if it still exists */
if (PyExc_MemoryErrorInst) if (PyExc_MemoryErrorInst)
PyErr_SetObject(PyExc_MemoryError, PyExc_MemoryErrorInst); PyErr_SetObject(PyExc_MemoryError, PyExc_MemoryErrorInst);