diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-07-30 18:09:36 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-07-30 18:09:36 (GMT) |
commit | 8547a0e29be7c16bb3d45077f1e95bf7ba313a77 (patch) | |
tree | 46f1496de19419abe6cd410b8198a7813f778374 /Doc/extending | |
parent | 796564c27b8f2e32b9fbc034bbdda75f9507ca43 (diff) | |
parent | 3ab7b0aabbea477a5c4a9738f41a0ad4f0c606f5 (diff) | |
download | cpython-8547a0e29be7c16bb3d45077f1e95bf7ba313a77.zip cpython-8547a0e29be7c16bb3d45077f1e95bf7ba313a77.tar.gz cpython-8547a0e29be7c16bb3d45077f1e95bf7ba313a77.tar.bz2 |
Merge doc fix
Diffstat (limited to 'Doc/extending')
-rw-r--r-- | Doc/extending/newtypes.rst | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index d5ee877..003d666 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -964,10 +964,9 @@ done. This can be done using the :c:func:`PyErr_Fetch` and if (self->my_callback != NULL) { PyObject *err_type, *err_value, *err_traceback; - int have_error = PyErr_Occurred() ? 1 : 0; - if (have_error) - PyErr_Fetch(&err_type, &err_value, &err_traceback); + /* This saves the current exception state */ + PyErr_Fetch(&err_type, &err_value, &err_traceback); cbresult = PyObject_CallObject(self->my_callback, NULL); if (cbresult == NULL) @@ -975,8 +974,8 @@ done. This can be done using the :c:func:`PyErr_Fetch` and else Py_DECREF(cbresult); - if (have_error) - PyErr_Restore(err_type, err_value, err_traceback); + /* This restores the saved exception state */ + PyErr_Restore(err_type, err_value, err_traceback); Py_DECREF(self->my_callback); } |