mirror of
https://github.com/python/cpython.git
synced 2024-11-24 18:34:43 +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 *
|
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user