Issue #18520: PyErr_NoMemory() now fails with a fatal error if it is called
before PyExc_MemoryError has been initialized by _PyExc_Init()
This commit is contained in:
parent
1c8f059019
commit
f54a574478
|
@ -380,6 +380,12 @@ PyErr_BadArgument(void)
|
|||
PyObject *
|
||||
PyErr_NoMemory(void)
|
||||
{
|
||||
if (Py_TYPE(PyExc_MemoryError) == NULL) {
|
||||
/* PyErr_NoMemory() has been called before PyExc_MemoryError has been
|
||||
initialized by _PyExc_Init() */
|
||||
Py_FatalError("Out of memory and PyExc_MemoryError is not "
|
||||
"initialized yet");
|
||||
}
|
||||
PyErr_SetNone(PyExc_MemoryError);
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue