Is sqlite3.threadsafety the same thing as sqlite3_threadsafe() from the C library?

It seems to me that the default SQLite threaded mode (serialized, SQLITE_THEADSAFE=1) actually implies DB-API 2.0 threadsafety=3, because the module, connections, and cursors (prepared statements) can be shared. SQLITE_THREADSAFE=2 (multi-thread mode) implies DB-API 2.0 threadsafety=1, and SQLITE_THREADSAFE=0 (single-thread mode) implies DB-API 2.0 threadsafety=0.

UPDATE: I’ve opened bpo-45613 and GH-29227 for this.

1 Like