william tonkin added the comment: sqlite3 allows a connection to be built from an apsw.Connection(). Using an apsw.Connection() to build an sqlite3.connect() implies that the underlying sqlite database engine will have extended error codes turned on (the default if for them to be turned off.)
The problem is that Modules/_sqlite/util.c:_pysqlite_seterror() is not extended error code aware. In particular, the extended error code SQLITE_CONSTRAINT_CHECK will not be recognized as a kind of constraint violation and will fall into the "default:" arm of the case statement. This will result in raising the exception DatabaseError when the correct exception to raise is IntegrityError. One simple solution would be to convert the extended error code back to the base error code, that is: "errorcode = 0xffu % sqlite3_errcode(db);" ---------- status: closed -> open type: -> behavior _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22382> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com