Erlend E. Aasland <erlend.aasl...@innova.no> added the comment:
This change breaks existing behaviour (see test below). Also, sqlite3_column_count() is implemented as a simple lookup in SQLite; it is never an expensive function. Suggests to add the following test instead: diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py index 77fafe0930..d7a3b249ab 100644 --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -555,6 +555,17 @@ def test_last_row_id_insert_o_r(self): ] self.assertEqual(results, expected) + def test_column_count(self): + # Check that column count is updated correctly for cached statements + select = "select * from test" + res = self.cu.execute(select) + old_count = len(res.description) + # Add a new column and execute the cached select query again + self.cu.execute("alter table test add newcol") + res = self.cu.execute(select) + new_count = len(res.description) + self.assertEqual(old_count - new_count, 1) + class ThreadTests(unittest.TestCase): def setUp(self): ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44041> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com