mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00: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
1 changed files with 4 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue