We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 619eac7 commit d680b17Copy full SHA for d680b17
1 file changed
Modules/xxlimited.c
@@ -257,15 +257,22 @@ Xxo_finalize(PyObject *self)
257
}
258
259
// dealloc: drop all remaining references and free memory
260
+// This function must preserve currently raised exception, if any.
261
static void
262
Xxo_dealloc(PyObject *self)
263
{
264
+ PyObject *exc = PyErr_GetRaisedException();
265
PyObject_GC_UnTrack(self);
266
Xxo_finalize(self);
267
PyTypeObject *tp = Py_TYPE(self);
268
freefunc free = PyType_GetSlot(tp, Py_tp_free);
269
free(self);
270
Py_DECREF(tp);
271
+
272
+ if (PyErr_Occurred()) {
273
+ PyErr_WriteUnraisable(NULL);
274
+ }
275
+ PyErr_SetRaisedException(exc);
276
277
278
0 commit comments