I’m looking at
sqlite3.threadsafety and wondering if it’s the same thing as
sqlite3_threadsafe() from the C library. The names suggest they are the same, but since
sqlite3.threadsafety is hardcoded that suggests their values are independent.
There is way to query SQLite itself for the thread safety compiler option, via
>>> ( sqlite3.connect(':memory:') .execute(""" select * from pragma_COMPILE_OPTIONS where compile_options like 'THREADSAFE=%' """) .fetchall() ) [('THREADSAFE=1',)]
According to the SQLite docs, the value returned by checking
pragma COMPILE_OPTIONS is the same value returned by
So my question is: Is it possible for Python’s
sqlite3.threadsafety to ever disagree with what’s returned by
If not, what keeps
sqlite3.threadsafety in sync with
COMPILE_OPTIONS? It’s not obvious to me since its value is hardcoded.