← 输入框|bugs.python.org|刷新

➜

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.

classification
标题: SQLite: sqlite3_enable_shared_cache() is deprecated
类型: Stage: resolved
Components: Library (Lib), macOS Versions: Python 3.7
process
状态: closed Resolution: duplicate
Dependencies: 后续: "sqlite3_enable_shared_cache" deprecation warning when compiling with macOS system SQLite3
View: 24464
分配给: 抄送列表: erlendaasland, ned.deily, ronaldoussoren
优先级: normal 关键字:

Created on 2017-06-13 08:34 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg295867 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 2017-06-13 08:34
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.
msg295902 - (view) Author: Ned Deily (ned.deily) * (Python committer) 日期: 2017-06-13 11:22
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.
msg295954 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) 日期: 2017-06-13 19:24
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.
msg376441 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) 日期: 2020-09-05 20:11
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.
msg376443 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) 日期: 2020-09-05 20:37
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.
历史
日期 用户 动作 参数
2022-04-11 14:58:47admin修改github: 74831
2020-09-06 10:15:30vstinner修改抄送: - vstinner
2020-09-05 20:37:13erlendaasland修改消息: + msg376443
2020-09-05 20:11:34erlendaasland修改抄送: + erlendaasland
消息: + msg376441
2019-09-29 06:41:17ned.deily修改后续: "sqlite3_enable_shared_cache" deprecation warning when compiling with macOS system SQLite3
resolution: third party -> duplicate
2017-06-13 19:24:03ronaldoussoren修改消息: + msg295954
2017-06-13 11:22:18ned.deily修改状态: open -> closed
resolution: third party
消息: + msg295902

stage: resolved
2017-06-13 08:34:13vstinner创建