mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
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
1 changed files with 6 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue