comparison Python/errors.c @ 6190:b5757e87eb32 legacy-trunk

PyErr_NoMemory(): If the pre-instantiated memory exception is non-null (PyExc_MemoryErrorInst) raise this instead of PyExc_MemoryError. This only happens when exception classes are enabled (e.g. when Python is started with -X).
author Barry Warsaw <barry@python.org>
date Fri, 29 Aug 1997 21:54:35 +0000
parents a2a1df0ca808
children b7f0b98f5325
comparison
equal deleted inserted replaced
6189:e4710119b41c 6190:b5757e87eb32
254 } 254 }
255 255
256 PyObject * 256 PyObject *
257 PyErr_NoMemory() 257 PyErr_NoMemory()
258 { 258 {
259 PyErr_SetNone(PyExc_MemoryError); 259 /* raise the pre-allocated instance if it still exists */
260 if (PyExc_MemoryErrorInst)
261 PyErr_SetObject(PyExc_MemoryError, PyExc_MemoryErrorInst);
262 else
263 /* this will probably fail since there's no memory and hee,
264 hee, we have to instantiate this class
265 */
266 PyErr_SetNone(PyExc_MemoryError);
267
260 return NULL; 268 return NULL;
261 } 269 }
262 270
263 PyObject * 271 PyObject *
264 PyErr_SetFromErrno(exc) 272 PyErr_SetFromErrno(exc)