diff -r 276477d5a548 Modules/_sqlite/connection.c --- a/Modules/_sqlite/connection.c Sun Jul 21 13:25:51 2013 +0200 +++ b/Modules/_sqlite/connection.c Mon Jul 22 08:20:10 2013 +0200 @@ -884,32 +884,31 @@ static int _authorizer_callback(void* us gilstate = PyGILState_Ensure(); #endif - if (!PyErr_Occurred()) { - ret = PyObject_CallFunction((PyObject*)user_arg, "issss", action, arg1, arg2, dbname, access_attempt_source); + ret = PyObject_CallFunction((PyObject*)user_arg, "issss", action, arg1, arg2, dbname, access_attempt_source); - if (!ret) { - if (_enable_callback_tracebacks) { - PyErr_Print(); - } else { - PyErr_Clear(); - } + if (!ret) { + if (_enable_callback_tracebacks) + PyErr_Print(); + else + PyErr_Clear(); - rc = SQLITE_DENY; - } else { - if (PyLong_Check(ret)) { - rc = _PyLong_AsInt(ret); - if (rc == -1 && PyErr_Occurred()) - rc = SQLITE_DENY; - } else { - rc = SQLITE_DENY; - } - Py_DECREF(ret); - } + rc = SQLITE_DENY; } else { - /* A previous call to the authorizer callback failed and raised an - exception: don't call the Python authorizer callback */ - rc = SQLITE_DENY; + if (PyLong_Check(ret)) { + rc = _PyLong_AsInt(ret); + if (rc == -1 && PyErr_Occurred()) { + rc = SQLITE_DENY; + if (_enable_callback_tracebacks) + PyErr_Print(); + else + PyErr_Clear(); + } + } + else { + rc = SQLITE_DENY; + } + Py_DECREF(ret); } #ifdef WITH_THREAD