]> granicus.if.org Git - python/commitdiff
Issue #18408: Fix _pysqlite_fetch_one_row(), in debug mode, don't call
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 17 Jul 2013 23:54:37 +0000 (01:54 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Wed, 17 Jul 2013 23:54:37 +0000 (01:54 +0200)
type_call() with an exception set

Modules/_sqlite/cursor.c

index 49994158db567b0bc90c4651039f1afbd6e1498d..8f9bd699a6c5c771749a389d0bf71868de840ac3 100644 (file)
@@ -339,6 +339,11 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self)
                 if (self->connection->text_factory == (PyObject*)&PyUnicode_Type) {
                     converted = PyUnicode_FromStringAndSize(val_str, nbytes);
                     if (!converted) {
+#ifdef Py_DEBUG
+                        /* in debug mode, type_call() fails with an assertion
+                           error if an exception is set when it is called */
+                        PyErr_Clear();
+#endif
                         colname = sqlite3_column_name(self->statement->st, i);
                         if (!colname) {
                             colname = "<unknown column name>";