[Python-checkins] cpython: Issue #18488: Fix _pysqlite_final_callback()

victor.stinner python-checkins at python.org
Mon Jul 22 08:35:20 CEST 2013


http://hg.python.org/cpython/rev/020dbfdf9517
changeset:   84780:020dbfdf9517
parent:      84774:bf9ccd08f559
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Jul 22 08:34:32 2013 +0200
summary:
  Issue #18488: Fix _pysqlite_final_callback()

Restore behaviour of Python 3.3: print the finalizer() error if
sqlite3.enable_callback_tracebacks() has been called, clear the error
otherwise.

But keep (save/restore) also the AttributeError raised in
_pysqlite_step_callback().

files:
  Modules/_sqlite/connection.c |  8 ++++----
  1 files changed, 4 insertions(+), 4 deletions(-)


diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -718,10 +718,6 @@
 
     function_result = _PyObject_CallMethodId(*aggregate_instance, &PyId_finalize, "");
 
-    /* Restore the exception (if any) of the last call to step(),
-       but clear also the current exception if finalize() failed */
-    PyErr_Restore(exception, value, tb);
-
     Py_DECREF(*aggregate_instance);
 
     ok = 0;
@@ -738,6 +734,10 @@
         _sqlite3_result_error(context, "user-defined aggregate's 'finalize' method raised error", -1);
     }
 
+    /* Restore the exception (if any) of the last call to step(),
+       but clear also the current exception if finalize() failed */
+    PyErr_Restore(exception, value, tb);
+
 error:
 #ifdef WITH_THREAD
     PyGILState_Release(threadstate);

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


More information about the Python-checkins mailing list