comparison Python/errors.c @ 48598:de75e7280b7a

Correct one of the "MemoryError oddities": the traceback would grow each time a MemoryError is raised.
author Amaury Forgeot d'Arc <amauryfa@gmail.com>
date Thu, 31 Jul 2008 22:56:02 +0000
parents 1ec38b707cd6
children 85b67fb5672b
comparison
equal deleted inserted replaced
48597:fec985cbf53f 48598:de75e7280b7a
319 /* already current */ 319 /* already current */
320 return NULL; 320 return NULL;
321 321
322 /* raise the pre-allocated instance if it still exists */ 322 /* raise the pre-allocated instance if it still exists */
323 if (PyExc_MemoryErrorInst) 323 if (PyExc_MemoryErrorInst)
324 {
325 /* Clear the previous traceback, otherwise it will be appended
326 * to the current one.
327 *
328 * The following statement is not likely to raise any error;
329 * if it does, we simply discard it.
330 */
331 PyException_SetTraceback(PyExc_MemoryErrorInst, Py_None);
332
324 PyErr_SetObject(PyExc_MemoryError, PyExc_MemoryErrorInst); 333 PyErr_SetObject(PyExc_MemoryError, PyExc_MemoryErrorInst);
334 }
325 else 335 else
326 /* this will probably fail since there's no memory and hee, 336 /* this will probably fail since there's no memory and hee,
327 hee, we have to instantiate this class 337 hee, we have to instantiate this class
328 */ 338 */
329 PyErr_SetNone(PyExc_MemoryError); 339 PyErr_SetNone(PyExc_MemoryError);