commit 108b80f2299e5f14b4e6a1536f492b02ba74d263 Author: Erlend E. Aasland Date: Wed May 5 00:42:59 2021 +0200 fprintf debugging diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 28932726b7..3856d0f205 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -107,6 +107,7 @@ pysqlite_connection_init(pysqlite_Connection *self, PyObject *args, Py_XSETREF(self->text_factory, (PyObject*)&PyUnicode_Type); Py_BEGIN_ALLOW_THREADS + fprintf(stderr, "sqlite3_open_v2(db=\"%s\", ...)\n", database); rc = sqlite3_open_v2(database, &self->db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | (uri ? SQLITE_OPEN_URI : 0), NULL); @@ -159,6 +160,7 @@ pysqlite_connection_init(pysqlite_Connection *self, PyObject *args, self->detect_types = detect_types; self->timeout = timeout; + fprintf(stderr, "sqlite3_busy_timeout(db=%p, ...)\n", self->db); (void)sqlite3_busy_timeout(self->db, (int)(timeout*1000)); self->thread_ident = PyThread_get_thread_ident(); self->check_same_thread = check_same_thread; @@ -234,7 +236,9 @@ pysqlite_connection_dealloc(pysqlite_Connection *self) /* Clean up if user has not called .close() explicitly. */ if (self->db) { - sqlite3_close_v2(self->db); + int rc = sqlite3_close_v2(self->db); + fprintf(stderr, "sqlite3_close_v2(db=%p) => %d: %s\n", + self->db, rc, sqlite3_errstr(rc)); } Py_XDECREF(self->isolation_level); @@ -340,6 +344,8 @@ pysqlite_connection_close_impl(pysqlite_Connection *self) if (self->db) { rc = sqlite3_close_v2(self->db); + fprintf(stderr, "sqlite3_close_v2(db=%p) => %d: %s\n", + self->db, rc, sqlite3_errstr(rc)); if (rc != SQLITE_OK) { _pysqlite_seterror(self->db); @@ -378,6 +384,8 @@ PyObject* _pysqlite_connection_begin(pysqlite_Connection* self) sqlite3_stmt* statement; Py_BEGIN_ALLOW_THREADS + fprintf(stderr, "\nsqlite3_prepare_v2(db=%p, sql=\"%s\", ...)\n", + self->db, self->begin_statement); rc = sqlite3_prepare_v2(self->db, self->begin_statement, -1, &statement, NULL); Py_END_ALLOW_THREADS @@ -392,6 +400,7 @@ PyObject* _pysqlite_connection_begin(pysqlite_Connection* self) _pysqlite_seterror(self->db); } + fprintf(stderr, "sqlite3_finalize(stmt=%p)\n\n", statement); Py_BEGIN_ALLOW_THREADS rc = sqlite3_finalize(statement); Py_END_ALLOW_THREADS @@ -425,9 +434,12 @@ pysqlite_connection_commit_impl(pysqlite_Connection *self) return NULL; } + fprintf(stderr, "sqlite3_get_autocommit(db=%p)\n", self->db); if (!sqlite3_get_autocommit(self->db)) { Py_BEGIN_ALLOW_THREADS + fprintf(stderr, "\nsqlite3_prepare_v2(db=%p, sql=\"commit\", ...)\n", + self->db); rc = sqlite3_prepare_v2(self->db, "COMMIT", -1, &statement, NULL); Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { @@ -440,6 +452,7 @@ pysqlite_connection_commit_impl(pysqlite_Connection *self) _pysqlite_seterror(self->db); } + fprintf(stderr, "sqlite3_finalize(stmt=%p)\n\n", statement); Py_BEGIN_ALLOW_THREADS rc = sqlite3_finalize(statement); Py_END_ALLOW_THREADS @@ -474,10 +487,13 @@ pysqlite_connection_rollback_impl(pysqlite_Connection *self) return NULL; } + fprintf(stderr, "sqlite3_get_autocommit(db=%p)\n", self->db); if (!sqlite3_get_autocommit(self->db)) { pysqlite_do_all_statements(self, ACTION_RESET, 1); Py_BEGIN_ALLOW_THREADS + fprintf(stderr, "\nsqlite3_prepare_v2(db=%p, sql=\"rollback\", ...)\n", + self->db); rc = sqlite3_prepare_v2(self->db, "ROLLBACK", -1, &statement, NULL); Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { @@ -491,6 +507,7 @@ pysqlite_connection_rollback_impl(pysqlite_Connection *self) } Py_BEGIN_ALLOW_THREADS + fprintf(stderr, "sqlite3_finalize(stmt=%p)\n\n", statement); rc = sqlite3_finalize(statement); Py_END_ALLOW_THREADS if (rc != SQLITE_OK && !PyErr_Occurred()) { @@ -511,18 +528,22 @@ static int _pysqlite_set_result(sqlite3_context* context, PyObject* py_val) { if (py_val == Py_None) { + fprintf(stderr, "sqlite3_result_null(ctx=%p)\n", context); sqlite3_result_null(context); } else if (PyLong_Check(py_val)) { sqlite_int64 value = _pysqlite_long_as_int64(py_val); if (value == -1 && PyErr_Occurred()) return -1; + fprintf(stderr, "sqlite3_result_int64(ctx=%p, ...)\n", context); sqlite3_result_int64(context, value); } else if (PyFloat_Check(py_val)) { + fprintf(stderr, "sqlite3_result_double(ctx=%p, ...)\n", context); sqlite3_result_double(context, PyFloat_AsDouble(py_val)); } else if (PyUnicode_Check(py_val)) { const char *str = PyUnicode_AsUTF8(py_val); if (str == NULL) return -1; + fprintf(stderr, "sqlite3_result_text(ctx=%p, ...)\n", context); sqlite3_result_text(context, str, -1, SQLITE_TRANSIENT); } else if (PyObject_CheckBuffer(py_val)) { Py_buffer view; @@ -537,6 +558,7 @@ _pysqlite_set_result(sqlite3_context* context, PyObject* py_val) PyBuffer_Release(&view); return -1; } + fprintf(stderr, "sqlite3_result_blob(ctx=%p, ...)\n", context); sqlite3_result_blob(context, view.buf, (int)view.len, SQLITE_TRANSIENT); PyBuffer_Release(&view); } else { @@ -562,14 +584,18 @@ _pysqlite_build_py_params(sqlite3_context *context, int argc, for (i = 0; i < argc; i++) { cur_value = argv[i]; + fprintf(stderr, "sqlite3_value_type(val=%p, ...)\n", argv[i]); switch (sqlite3_value_type(argv[i])) { case SQLITE_INTEGER: + fprintf(stderr, "sqlite3_value_int64(...)\n"); cur_py_value = PyLong_FromLongLong(sqlite3_value_int64(cur_value)); break; case SQLITE_FLOAT: + fprintf(stderr, "sqlite3_value_double(...)\n"); cur_py_value = PyFloat_FromDouble(sqlite3_value_double(cur_value)); break; case SQLITE_TEXT: + fprintf(stderr, "sqlite3_value_text(...)\n"); val_str = (const char*)sqlite3_value_text(cur_value); cur_py_value = PyUnicode_FromString(val_str); /* TODO: have a way to show errors here */ @@ -580,6 +606,7 @@ _pysqlite_build_py_params(sqlite3_context *context, int argc, break; case SQLITE_BLOB: { sqlite3 *db = sqlite3_context_db_handle(context); + fprintf(stderr, "sqlite3_value_blob(...)\n"); const void *blob = sqlite3_value_blob(cur_value); if (blob == NULL && sqlite3_errcode(db) == SQLITE_NOMEM) { @@ -587,6 +614,7 @@ _pysqlite_build_py_params(sqlite3_context *context, int argc, goto error; } + fprintf(stderr, "sqlite3_value_bytes(...)\n"); Py_ssize_t size = sqlite3_value_bytes(cur_value); cur_py_value = PyBytes_FromStringAndSize(blob, size); break; @@ -622,6 +650,7 @@ _pysqlite_func_callback(sqlite3_context *context, int argc, sqlite3_value **argv threadstate = PyGILState_Ensure(); + fprintf(stderr, "sqlite3_user_data(ctx=%p)\n", context); py_func = (PyObject*)sqlite3_user_data(context); args = _pysqlite_build_py_params(context, argc, argv); @@ -641,6 +670,7 @@ _pysqlite_func_callback(sqlite3_context *context, int argc, sqlite3_value **argv } else { PyErr_Clear(); } + fprintf(stderr, "sqlite3_result_error(ctx=%p, ...)\n", context); sqlite3_result_error(context, "user-defined function raised exception", -1); } @@ -659,8 +689,10 @@ static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_ threadstate = PyGILState_Ensure(); + fprintf(stderr, "sqlite3_user_data(ctx=%p)\n", context); aggregate_class = (PyObject*)sqlite3_user_data(context); + fprintf(stderr, "sqlite3_aggregate_context(ctx=%p, ...)\n", context); aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*)); if (*aggregate_instance == NULL) { @@ -673,6 +705,7 @@ static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_ } else { PyErr_Clear(); } + fprintf(stderr, "sqlite3_result_error(ctx=%p, ...)\n", context); sqlite3_result_error(context, "user-defined aggregate's '__init__' method raised error", -1); goto error; } @@ -697,6 +730,7 @@ static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_ } else { PyErr_Clear(); } + fprintf(stderr, "sqlite3_result_error(ctx=%p, ...)\n", context); sqlite3_result_error(context, "user-defined aggregate's 'step' method raised error", -1); } @@ -720,6 +754,7 @@ _pysqlite_final_callback(sqlite3_context *context) threadstate = PyGILState_Ensure(); + fprintf(stderr, "sqlite3_aggregate_context(ctx=%p, ...)\n", context); aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, 0); if (aggregate_instance == NULL) { /* No rows matched the query; the step handler was never called. */ @@ -750,6 +785,7 @@ _pysqlite_final_callback(sqlite3_context *context) } else { PyErr_Clear(); } + fprintf(stderr, "sqlite3_result_error(ctx=%p, ...)\n", context); sqlite3_result_error(context, "user-defined aggregate's 'finalize' method raised error", -1); } @@ -1241,6 +1277,7 @@ static PyObject* pysqlite_connection_get_total_changes(pysqlite_Connection* self if (!pysqlite_check_connection(self)) { return NULL; } else { + fprintf(stderr, "sqlite3_total_changes(db=%p)\n", self->db); return Py_BuildValue("i", sqlite3_total_changes(self->db)); } } @@ -1250,6 +1287,7 @@ static PyObject* pysqlite_connection_get_in_transaction(pysqlite_Connection* sel if (!pysqlite_check_connection(self)) { return NULL; } + fprintf(stderr, "sqlite3_get_autocommit(db=%p)\n", self->db); if (!sqlite3_get_autocommit(self->db)) { Py_RETURN_TRUE; } @@ -1546,6 +1584,7 @@ pysqlite_connection_interrupt_impl(pysqlite_Connection *self) goto finally; } + fprintf(stderr, "sqlite3_interrupt(db=%p)\n", self->db); sqlite3_interrupt(self->db); retval = Py_NewRef(Py_None); diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index b71f780a0b..4744494745 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -151,6 +151,8 @@ pysqlite_build_row_cast_map(pysqlite_Cursor* self) converter = NULL; if (self->connection->detect_types & PARSE_COLNAMES) { + fprintf(stderr, "sqlite3_column_name(stmt=%p, pos=%d)\n", + self->statement->st, i); const char *colname = sqlite3_column_name(self->statement->st, i); if (colname == NULL) { PyErr_NoMemory(); @@ -174,6 +176,8 @@ pysqlite_build_row_cast_map(pysqlite_Cursor* self) } if (!converter && self->connection->detect_types & PARSE_DECLTYPES) { + fprintf(stderr, "sqlite3_column_decltype(stmt=%p, pos=%d)\n", + self->statement->st, i); decltype = sqlite3_column_decltype(self->statement->st, i); if (decltype) { for (pos = decltype;;pos++) { @@ -253,6 +257,7 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self) return NULL; } + fprintf(stderr, "sqlite3_data_count(stmt=%p)\n", self->statement->st); Py_BEGIN_ALLOW_THREADS numcols = sqlite3_data_count(self->statement->st); Py_END_ALLOW_THREADS @@ -280,6 +285,8 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self) * See https://sqlite.org/c3ref/column_blob.html for details. */ if (converter != Py_None) { + fprintf(stderr, "sqlite3_column_blob(stmt=%p, pos=%d)\n", + self->statement->st, i); const void *blob = sqlite3_column_blob(self->statement->st, i); if (blob == NULL) { if (sqlite3_errcode(db) == SQLITE_NOMEM) { @@ -289,6 +296,8 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self) converted = Py_NewRef(Py_None); } else { + fprintf(stderr, "sqlite3_column_bytes(stmt=%p, pos=%d)\n", + self->statement->st, i); nbytes = sqlite3_column_bytes(self->statement->st, i); PyObject *item = PyBytes_FromStringAndSize(blob, nbytes); if (item == NULL) { @@ -299,26 +308,38 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self) } } else { Py_BEGIN_ALLOW_THREADS + fprintf(stderr, "sqlite3_column_type(stmt=%p, pos=%d)\n", + self->statement->st, i); coltype = sqlite3_column_type(self->statement->st, i); Py_END_ALLOW_THREADS if (coltype == SQLITE_NULL) { converted = Py_NewRef(Py_None); } else if (coltype == SQLITE_INTEGER) { + fprintf(stderr, "sqlite3_column_int64(stmt=%p, pos=%d)\n", + self->statement->st, i); converted = PyLong_FromLongLong(sqlite3_column_int64(self->statement->st, i)); } else if (coltype == SQLITE_FLOAT) { + fprintf(stderr, "sqlite3_column_double(stmt=%p, pos=%d)\n", + self->statement->st, i); converted = PyFloat_FromDouble(sqlite3_column_double(self->statement->st, i)); } else if (coltype == SQLITE_TEXT) { + fprintf(stderr, "sqlite3_column_text(stmt=%p, pos=%d)\n", + self->statement->st, i); const char *text = (const char*)sqlite3_column_text(self->statement->st, i); if (text == NULL && sqlite3_errcode(db) == SQLITE_NOMEM) { PyErr_NoMemory(); goto error; } + fprintf(stderr, "sqlite3_column_bytes(stmt=%p, pos=%d)\n", + self->statement->st, i); nbytes = sqlite3_column_bytes(self->statement->st, i); if (self->connection->text_factory == (PyObject*)&PyUnicode_Type) { converted = PyUnicode_FromStringAndSize(text, nbytes); if (!converted && PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) { PyErr_Clear(); + fprintf(stderr, "sqlite3_column_name(stmt=%p, pos=%d)\n", + self->statement->st, i); colname = sqlite3_column_name(self->statement->st, i); if (colname == NULL) { PyErr_NoMemory(); @@ -343,12 +364,16 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self) } } else { /* coltype == SQLITE_BLOB */ + fprintf(stderr, "sqlite3_column_blob(stmt=%p, pos=%d)\n", + self->statement->st, i); const void *blob = sqlite3_column_blob(self->statement->st, i); if (blob == NULL && sqlite3_errcode(db) == SQLITE_NOMEM) { PyErr_NoMemory(); goto error; } + fprintf(stderr, "sqlite3_column_bytes(stmt=%p, pos=%d)\n", + self->statement->st, i); nbytes = sqlite3_column_bytes(self->statement->st, i); converted = PyBytes_FromStringAndSize(blob, nbytes); } @@ -474,6 +499,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation } if (self->statement) { + fprintf(stderr, "SECONDRESET: "); (void)pysqlite_statement_reset(self->statement); } @@ -504,6 +530,8 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation /* We start a transaction implicitly before a DML statement. SELECT is the only exception. See #9924. */ if (self->connection->begin_statement && self->statement->is_dml) { + fprintf(stderr, "sqlite3_get_autocommit(db=%p)\n", + self->connection->db); if (sqlite3_get_autocommit(self->connection->db)) { result = _pysqlite_connection_begin(self->connection); if (!result) { @@ -557,6 +585,8 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation } for (i = 0; i < numcols; i++) { const char *colname; + fprintf(stderr, "sqlite3_column_name(stmt=%p, pos=%d)\n", + self->statement->st, i); colname = sqlite3_column_name(self->statement->st, i); if (colname == NULL) { PyErr_NoMemory(); @@ -578,6 +608,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation } if (self->statement->is_dml) { + fprintf(stderr, "sqlite3_changes(db=%p)\n", self->connection->db); self->rowcount += (long)sqlite3_changes(self->connection->db); } else { self->rowcount= -1L; @@ -585,6 +616,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation if (!multiple) { Py_BEGIN_ALLOW_THREADS + fprintf(stderr, "sqlite3_last_insert_rowid(db=%p)\n", self->connection->db); lastrowid = sqlite3_last_insert_rowid(self->connection->db); Py_END_ALLOW_THREADS Py_SETREF(self->lastrowid, PyLong_FromLongLong(lastrowid)); @@ -708,6 +740,8 @@ pysqlite_cursor_executescript(pysqlite_Cursor *self, PyObject *script_obj) while (1) { Py_BEGIN_ALLOW_THREADS + fprintf(stderr, "\nsqlite3_prepare_v2(db=%p, sql=script, ...)\n", + self->connection->db); rc = sqlite3_prepare_v2(self->connection->db, script_cstr, -1, @@ -723,17 +757,20 @@ pysqlite_cursor_executescript(pysqlite_Cursor *self, PyObject *script_obj) do { rc = pysqlite_step(statement, self->connection); if (PyErr_Occurred()) { + fprintf(stderr, "sqlite3_finalize(stmt=%p)\n", statement); (void)sqlite3_finalize(statement); goto error; } } while (rc == SQLITE_ROW); if (rc != SQLITE_DONE) { + fprintf(stderr, "sqlite3_finalize(stmt=%p)\n", statement); (void)sqlite3_finalize(statement); _pysqlite_seterror(self->connection->db); goto error; } + fprintf(stderr, "sqlite3_finalize(stmt=%p)\n", statement); rc = sqlite3_finalize(statement); if (rc != SQLITE_OK) { _pysqlite_seterror(self->connection->db); diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c index 57026270e1..27fd5d6feb 100644 --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@ -99,11 +99,14 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con -1, &self->st, &tail); + fprintf(stderr, "\nsqlite3_prepare_v2(db=%p, sql=\"%s\", ...) => %d: %s\n", + connection->db, sql_cstr, rc, sqlite3_errstr(rc)); Py_END_ALLOW_THREADS self->db = connection->db; if (rc == SQLITE_OK && pysqlite_check_remaining_sql(tail)) { + fprintf(stderr, "sqlite3_finalize(stmt=%p)\n", self->st); (void)sqlite3_finalize(self->st); self->st = NULL; rc = PYSQLITE_TOO_MUCH_SQL; @@ -120,6 +123,7 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec parameter_type paramtype; if (parameter == Py_None) { + fprintf(stderr, "sqlite3_bind_null(stmt=%p, pos=%d)\n", self->st, pos); rc = sqlite3_bind_null(self->st, pos); goto final; } @@ -147,11 +151,16 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec sqlite_int64 value = _pysqlite_long_as_int64(parameter); if (value == -1 && PyErr_Occurred()) rc = -1; - else + else { + fprintf(stderr, "sqlite3_bind_int64(stmt=%p, pos=%d, ...)\n", + self->st, pos); rc = sqlite3_bind_int64(self->st, pos, value); + } break; } case TYPE_FLOAT: + fprintf(stderr, "sqlite3_bind_double(stmt=%p, pos=%d, ...)\n", + self->st, pos); rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter)); break; case TYPE_UNICODE: @@ -163,6 +172,8 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec "string longer than INT_MAX bytes"); return -1; } + fprintf(stderr, "sqlite3_bind_text(stmt=%p, pos=%d, ...)\n", + self->st, pos); rc = sqlite3_bind_text(self->st, pos, string, (int)buflen, SQLITE_TRANSIENT); break; case TYPE_BUFFER: { @@ -177,6 +188,8 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec PyBuffer_Release(&view); return -1; } + fprintf(stderr, "sqlite3_bind_blob(stmt=%p, pos=%d, ...)\n", + self->st, pos); rc = sqlite3_bind_blob(self->st, pos, view.buf, (int)view.len, SQLITE_TRANSIENT); PyBuffer_Release(&view); break; @@ -214,6 +227,7 @@ void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* para int num_params_needed; Py_ssize_t num_params; + fprintf(stderr, "sqlite3_bind_blob_parameter_count(stmt=%p)\n", self->st); Py_BEGIN_ALLOW_THREADS num_params_needed = sqlite3_bind_parameter_count(self->st); Py_END_ALLOW_THREADS @@ -276,6 +290,7 @@ void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* para for (i = 1; i <= num_params_needed; i++) { PyObject *binding_name_obj; Py_BEGIN_ALLOW_THREADS + fprintf(stderr, "sqlite3_bind_blob_parameter_name(stmt=%p, pos=%d)\n", self->st, i); binding_name = sqlite3_bind_parameter_name(self->st, i); Py_END_ALLOW_THREADS if (!binding_name) { @@ -334,6 +349,7 @@ int pysqlite_statement_finalize(pysqlite_Statement* self) rc = SQLITE_OK; if (self->st) { Py_BEGIN_ALLOW_THREADS + fprintf(stderr, "sqlite3_finalize(stmt=%p)\n", self->st); rc = sqlite3_finalize(self->st); Py_END_ALLOW_THREADS self->st = NULL; @@ -353,11 +369,15 @@ int pysqlite_statement_reset(pysqlite_Statement* self) if (self->in_use && self->st) { Py_BEGIN_ALLOW_THREADS rc = sqlite3_reset(self->st); + fprintf(stderr, "sqlite3_reset(stmt=%p) => %d: %s\n", + self->st, rc, sqlite3_errstr(rc)); Py_END_ALLOW_THREADS if (rc == SQLITE_OK) { self->in_use = 0; } + } else { + fprintf(stderr, "sqlite3_reset => noop\n"); } return rc; @@ -375,7 +395,9 @@ pysqlite_statement_dealloc(pysqlite_Statement *self) if (self->st) { Py_BEGIN_ALLOW_THREADS - sqlite3_finalize(self->st); + int rc = sqlite3_finalize(self->st); + fprintf(stderr, "sqlite3_finalize(stmt=%p) => %d: %s\n", + self->st, rc, sqlite3_errstr(rc)); Py_END_ALLOW_THREADS } diff --git a/Modules/_sqlite/util.c b/Modules/_sqlite/util.c index 3676935b9e..21fce5d6af 100644 --- a/Modules/_sqlite/util.c +++ b/Modules/_sqlite/util.c @@ -30,6 +30,8 @@ int pysqlite_step(sqlite3_stmt* statement, pysqlite_Connection* connection) Py_BEGIN_ALLOW_THREADS rc = sqlite3_step(statement); + fprintf(stderr, "sqlite3_step(stmt=%p) => %d: %s\n", + statement, rc, sqlite3_errstr(rc)); Py_END_ALLOW_THREADS return rc;