#!/usr/bin/python import os import sqlite3 import sys DBFILE = '/tmp/bug.sqlite3.db' def test_bug_testcase1(conn): cursor = conn.cursor() cursor.execute('create table t(k primary key);') for i in range(3): cursor.execute('insert or replace into t(k) values(?);', (i,)) pass c = cursor.execute(' select k from t where k == ?;', (1,)) conn.commit() r = c.fetchone() c = cursor.execute(' select k from t where k == ?;', (2,)) def test_bug_testcase2(conn): cursor = conn.cursor() cursor.execute('create table first(id primary key);') for i in range(3): cursor.execute('insert or replace into first(id) values(?);', (i,)) pass results = cursor.execute(' select id from first;') while True: print "-- One iter --" results = cursor.fetchmany() if not results: break for result in results: print str(result) conn.commit() if __name__ == "__main__": if os.path.exists(DBFILE): os.unlink(DBFILE) pass conn = sqlite3.connect(DBFILE) test_bug_testcase1(conn) test_bug_testcase2(conn) """ RESULT OUTPUT: With Python 2.7.2: => Testcase 1 only: Traceback (most recent call last): File "sqlite_bug.py", line 44, in test_bug_testcase1(conn) File "sqlite_bug.py", line 18, in test_bug_testcase1 c = cursor.execute(' select k from t where k == ?;', (2,)) sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type => Testcase 2 only: -- One iter -- (0,) -- One iter -- (1,) -- One iter -- (0,) -- One iter -- (1,) -- One iter -- (2,) -- One iter -- """