[Python-checkins] cpython (merge 3.3 -> default): Merge doc fix

antoine.pitrou python-checkins at python.org
Tue Jul 30 20:09:46 CEST 2013


http://hg.python.org/cpython/rev/4e9c8807d029
changeset:   84913:4e9c8807d029
parent:      84911:3f994367a979
parent:      84912:79377c0efa4c
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Tue Jul 30 20:09:36 2013 +0200
summary:
  Merge doc fix

files:
  Doc/extending/newtypes.rst |  9 ++++-----
  1 files changed, 4 insertions(+), 5 deletions(-)


diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst
--- a/Doc/extending/newtypes.rst
+++ b/Doc/extending/newtypes.rst
@@ -964,10 +964,9 @@
 
        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 @@
            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);
        }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list