[pypy-commit] cffi default: Probably need to save/restore the current exception here
arigo
noreply at buildbot.pypy.org
Fri Sep 25 20:59:23 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r2274:2106b4532288
Date: 2015-09-25 21:00 +0200
http://bitbucket.org/cffi/cffi/changeset/2106b4532288/
Log: Probably need to save/restore the current exception here
diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -1661,6 +1661,11 @@
cdata_dealloc((CDataObject *)cd);
if (destructor != NULL) {
+ PyObject *error_type, *error_value, *error_traceback;
+
+ /* Save the current exception */
+ PyErr_Fetch(&error_type, &error_value, &error_traceback);
+
result = PyObject_CallFunctionObjArgs(destructor, origobj, NULL);
if (result != NULL) {
Py_DECREF(result);
@@ -1670,6 +1675,9 @@
origobj, NULL);
}
Py_DECREF(destructor);
+
+ /* Restore the saved exception */
+ PyErr_Restore(error_type, error_value, error_traceback);
}
Py_DECREF(origobj);
}
More information about the pypy-commit
mailing list