Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 84794:9b77b3ee6fb8
Issue #18520: PyErr_NoMemory() now fails with a fatal error if it is called
before PyExc_MemoryError has been initialized by _PyExc_Init()
| author | Victor Stinner <victor.stinner@gmail.com> |
|---|---|
| date | Mon, 22 Jul 2013 22:28:37 +0200 |
| parents | 48a869a39e2d |
| children | e63f19d0a651 |
comparison
equal
deleted
inserted
replaced
| 84793:fc718c177ee6 | 84794:9b77b3ee6fb8 |
|---|---|
| 378 } | 378 } |
| 379 | 379 |
| 380 PyObject * | 380 PyObject * |
| 381 PyErr_NoMemory(void) | 381 PyErr_NoMemory(void) |
| 382 { | 382 { |
| 383 if (Py_TYPE(PyExc_MemoryError) == NULL) { | |
| 384 /* PyErr_NoMemory() has been called before PyExc_MemoryError has been | |
| 385 initialized by _PyExc_Init() */ | |
| 386 Py_FatalError("Out of memory and PyExc_MemoryError is not " | |
| 387 "initialized yet"); | |
| 388 } | |
| 383 PyErr_SetNone(PyExc_MemoryError); | 389 PyErr_SetNone(PyExc_MemoryError); |
| 384 return NULL; | 390 return NULL; |
| 385 } | 391 } |
| 386 | 392 |
| 387 PyObject * | 393 PyObject * |
