Repository navigation
SQLite: sqlite3_enable_shared_cache() is deprecated #74831
Description
Activity
Warning seen on the macOS Travis CI job:
"warning: 'sqlite3_enable_shared_cache' is deprecated: first deprecated in OS X 10.7"https://travis-ci.org/python/cpython/jobs/242325662
clang -Wno-unused-result -Wsign-compare -g -O0 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -I./Include -I. -I/usr/local/opt/openssl/include -I/usr/local/include -I/Users/travis/build/python/cpython/Include -I/Users/travis/build/python/cpython -c /Users/travis/build/python/cpython/Modules/_gdbmmodule.c -o build/temp./Users/travis/build/python/cpython/Modules/_sqlite/module.c:136:10: warning: 'sqlite3_enable_shared_cache' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
rc = sqlite3_enable_shared_cache(do_enable);
^/usr/include/sqlite3.h:5170:31: note: 'sqlite3_enable_shared_cache' has been explicitly marked deprecated here
SQLITE_API int SQLITE_STDCALLmacosx-10.11-x86_64-3.6-pydebug/Users/travis/build/python/cpython/Modules/_gdbmmodule.o
sqlite3_enable_shared_cache(int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_2_0, __IPHONE_5_0);
^1 warning generated.
- added3.7 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
on Jun 13, 2017 That's another reason why the python.org macOS installer build and, to the best of my knowledge, most third-party distributors of Python on macOS use their own builds of sqlite3 rather than the Apple-supplied system one. I don't think there's anything new to be done here.
See also <https://sqlite.org/c3ref/enable_shared_cache.html\>. Apple basically disabled this function starting at macOS 10.7, that's why there's a warning.
It is possible to suppress the warning, but I don't think its worth the trouble.
BTW. The python documentation for this function claims this changes a thread-local setting, but the SQLite documentation says this is a process global setting in SQLite 3.5.0 and later (released in 2007). It is possible to make behaviour match the python documentation by making _sqlite3.enable_shared_cache store a flag that's used in the call to sqlite3_open_v2. That would be a backward compatibility concern (there's bound to be users that rely on the current behavior), but would also avoid this warning.
From the SQLite docs https://sqlite.org/c3ref/enable_shared_cache.html:
"Note: This method is disabled on MacOS X 10.7 and iOS version 5.0 and will always return SQLITE_MISUSE. On those systems, shared cache mode should be enabled per-database connection via sqlite3_open_v2() with SQLITE_OPEN_SHAREDCACHE."
We should make sure sqlite3_open_v2() calls use SQLITE_OPEN_SHAREDCACHE if we are running on macOS. This should be a pretty straight-forward fix.
A little bit too fast with my previous comment; just disregard that suggestion.
Maybe we should just disable the sqlite3.enable_shared_cache() method if we are running on macOS, since it will only result in a misuse error anyway.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: