mirror of
https://github.com/python/cpython.git
synced 2024-11-24 10:24:35 +08:00
Do not set a MemoryError exception over another MemoryError exception,
thus preserving the first one that has been raised.
This commit is contained in:
parent
8ae9ce5e5b
commit
0888ff17bd
@ -238,6 +238,10 @@ 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)
|
||||
PyErr_SetObject(PyExc_MemoryError, PyExc_MemoryErrorInst);
|
||||
|
Loading…
Reference in New Issue
Block a user