diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-09-01 02:47:25 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-09-01 02:47:25 (GMT) |
commit | b709df381034b6055f03644a8f2eb35cfc6cb411 (patch) | |
tree | 55a6c86396fefc64a68fef9a8621500c868320c4 /Objects | |
parent | b9ce5ada37f271cd2e9ec67f86a82a166f1e1296 (diff) | |
download | cpython-b709df381034b6055f03644a8f2eb35cfc6cb411.zip cpython-b709df381034b6055f03644a8f2eb35cfc6cb411.tar.gz cpython-b709df381034b6055f03644a8f2eb35cfc6cb411.tar.bz2 |
refactor __del__ exception handler into PyErr_WriteUnraisable
add sanity check to gc: if an exception occurs during GC, call
PyErr_WriteUnraisable and then call Py_FatalEror.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/classobject.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c index 0b595b9..615c8ba 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -519,26 +519,7 @@ instance_dealloc(register PyInstanceObject *inst) if ((del = instance_getattr2(inst, delstr)) != NULL) { PyObject *res = PyEval_CallObject(del, (PyObject *)NULL); if (res == NULL) { - PyObject *f, *t, *v, *tb; - PyErr_Fetch(&t, &v, &tb); - f = PySys_GetObject("stderr"); - if (f != NULL) { - PyFile_WriteString("Exception ", f); - if (t) { - PyFile_WriteObject(t, f, Py_PRINT_RAW); - if (v && v != Py_None) { - PyFile_WriteString(": ", f); - PyFile_WriteObject(v, f, 0); - } - } - PyFile_WriteString(" in ", f); - PyFile_WriteObject(del, f, 0); - PyFile_WriteString(" ignored\n", f); - PyErr_Clear(); /* Just in case */ - } - Py_XDECREF(t); - Py_XDECREF(v); - Py_XDECREF(tb); + PyErr_WriteUnraisable(del); } else Py_DECREF(res); |