This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: "sqlite3_enable_shared_cache" deprecation warning when compiling with macOS system SQLite3
Type: enhancement Stage: resolved
Components: Extension Modules, macOS Versions: Python 3.10
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, erlendaasland, ned.deily, ronaldoussoren, vajrasky
Priority: low Keywords: patch

Created on 2015-06-18 11:31 by vajrasky, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
remove_warning_compile__sqlite.patch vajrasky, 2015-06-18 11:31 review
Pull Requests
URL Status Linked Edit
PR 16469 devnexen, 2019-09-29 06:37
PR 24008 merged erlendaasland, 2020-12-30 13:54
PR 24170 merged erlendaasland, 2021-01-08 18:34
Messages (9)
msg245463 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2015-06-18 11:31
I got this warning when compiling sqlite3 module.

gcc -Wno-unused-result -Wsign-compare -g -O0 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -DMODULE_NAME="sqlite3" -DSQLITE_OMIT_LOAD_EXTENSION=1 -IModules/_sqlite -I/usr/include -I./Include -I. -IInclude -I/usr/local/include -I/Users/sky/Code/python/cpython/Include -I/Users/sky/Code/python/cpython -c /Users/sky/Code/python/cpython/Modules/_sqlite/module.c -o build/temp.macosx-10.10-x86_64-3.6-pydebug/Users/sky/Code/python/cpython/Modules/_sqlite/module.o
/Users/sky/Code/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:5006:16: note: 'sqlite3_enable_shared_cache' has been explicitly marked deprecated here
SQLITE_API int sqlite3_enable_shared_cache(int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __I...
1 warning generated.

The enable_shared_cache method will fail if it is used afterwards.
"Changing the shared_cache flag failed"

Here is the patch to remove the warning.
msg245592 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2015-06-21 12:19
<> appears to indicate that the function is deprecated on OSX 10.7 and iOS 5.0, but looking at the latest sources on that's not the case, the warning in the documentation appears to be for the version of SQLite that Apple ships with their systems.

Because of this I'm against merging this patch as is because it also affects anyone building using the upstream version of SQLite instead of the version shipped with OSX.

I'm -0 on suppressing the warning other ways, either by detecting that the build uses Apple's build of SQLite or by using pragma's to disable deprecation warnings for this functions.
msg245608 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-06-21 19:08
I agree with Ronald that the proposed patch should not be applied as is.  For example, the Pythons installed by the current OS X installers build and link with a newer version of libsqlite3.  This is one of several examples of third-party libraries for which the Apple-supplied version in OS X is old and users are better served by providing a newer version for use with Python.  I think a better approach would be to make it easier for people building from source on OS X to also build and include these newer versions, like the installer build does.
msg353488 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-09-29 06:53
Now that this has come up again, it's worth noting Ronald's comment in msg295954 from duplicate Issue30646:

"See also <>. 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."
msg353489 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-09-29 06:55
Also, I notice that, while there is docstring help for sqlite3.enable_shared_cache, it does not seem to be mentioned in the sqlite3 module doc page in the Library reference.
msg376445 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2020-09-05 20:44
The SQLite docs clearly states that using sqlite3_enable_shared_cache() is not recommended:

"Shared cache is disabled by default. It is recommended that it stay that way. In other words, do not use this routine. This interface continues to be provided for historical compatibility, but its use is discouraged. Any use of shared cache is discouraged."

If sqlite3.enable_shared_cache is not even documented, perhaps we could just deprecate and remove it?
msg384458 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2021-01-06 00:36
New changeset ddb5e11683c8db9d2095f2f9406701443c4dc9b3 by Erlend Egeberg Aasland in branch 'master':
bpo-24464: Deprecate sqlite3.enable_shared_cache (GH-24008)
msg384459 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2021-01-06 00:37
It's now deprecated in 3.10.
msg384717 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2021-01-09 11:26
New changeset d16f6176abdecbb7ab231dc78beccfaa095beff6 by Erlend Egeberg Aasland in branch 'master':
bpo-24464: Fix sqlite3.enable_shared_cache() deprecation wrapper (GH-24170)
Date User Action Args
2022-04-11 14:58:18adminsetgithub: 68652
2021-01-09 11:26:02berker.peksagsetmessages: + msg384717
2021-01-08 18:34:00erlendaaslandsetpull_requests: + pull_request22997
2021-01-06 00:39:23berker.peksagsetcomponents: + macOS
2021-01-06 00:37:33berker.peksagsetstatus: open -> closed

components: + Extension Modules, - Build, macOS
versions: + Python 3.10, - Python 3.9
messages: + msg384459
type: enhancement
resolution: fixed
stage: patch review -> resolved
2021-01-06 00:36:12berker.peksagsetnosy: + berker.peksag
messages: + msg384458
2020-12-30 13:54:49erlendaaslandsetpull_requests: + pull_request22850
2020-11-27 14:22:45ronaldoussorenlinkissue41015 superseder
2020-09-05 20:44:07erlendaaslandsetmessages: + msg376445
2020-05-24 22:04:59erlendaaslandsetnosy: + erlendaasland
2019-09-29 06:55:53ned.deilysetmessages: + msg353489
2019-09-29 06:53:57ned.deilysettitle: Got warning when compiling sqlite3 module on Mac OS X -> "sqlite3_enable_shared_cache" deprecation warning when compiling with macOS system SQLite3
messages: + msg353488
components: + Build
versions: + Python 3.9, - Python 3.4, Python 3.5, Python 3.6
2019-09-29 06:41:17ned.deilylinkissue30646 superseder
2019-09-29 06:37:55devnexensetstage: patch review
pull_requests: + pull_request16055
2019-09-29 06:35:27ned.deilylinkissue38311 superseder
2015-06-21 19:08:56ned.deilysetpriority: normal -> low

title: Got warning when compiling sqlite3 module on Mac OSX -> Got warning when compiling sqlite3 module on Mac OS X
messages: + msg245608
versions: + Python 3.6
2015-06-21 12:19:56ronaldoussorensetmessages: + msg245592
2015-06-18 11:31:43vajraskycreate