Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite: sqlite3_enable_shared_cache() is deprecated #74831

Closed
vstinner opened this issue Jun 13, 2017 · 5 comments
Closed

SQLite: sqlite3_enable_shared_cache() is deprecated #74831

vstinner opened this issue Jun 13, 2017 · 5 comments
Labels
3.7 (EOL) end of life OS-mac stdlib Python modules in the Lib dir

Comments

@vstinner
Copy link
Member

BPO 30646
Nosy @ronaldoussoren, @ned-deily, @erlend-aasland
Superseder
  • bpo-24464: "sqlite3_enable_shared_cache" deprecation warning when compiling with macOS system SQLite3
  • 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:

    assignee = None
    closed_at = <Date 2017-06-13.11:22:18.408>
    created_at = <Date 2017-06-13.08:34:13.720>
    labels = ['OS-mac', '3.7', 'library']
    title = 'SQLite: sqlite3_enable_shared_cache() is deprecated'
    updated_at = <Date 2020-09-06.10:15:30.728>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-09-06.10:15:30.728>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-06-13.11:22:18.408>
    closer = 'ned.deily'
    components = ['Library (Lib)', 'macOS']
    creation = <Date 2017-06-13.08:34:13.720>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30646
    keywords = []
    message_count = 5.0
    messages = ['295867', '295902', '295954', '376441', '376443']
    nosy_count = 3.0
    nosy_names = ['ronaldoussoren', 'ned.deily', 'erlendaasland']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '24464'
    type = None
    url = 'https://bugs.python.org/issue30646'
    versions = ['Python 3.7']

    @vstinner
    Copy link
    Member Author

    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.

    @vstinner vstinner added 3.7 (EOL) end of life stdlib Python modules in the Lib dir OS-mac labels Jun 13, 2017
    @ned-deily
    Copy link
    Member

    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.

    @ronaldoussoren
    Copy link
    Contributor

    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.

    @erlend-aasland
    Copy link
    Contributor

    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.

    @erlend-aasland
    Copy link
    Contributor

    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.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life OS-mac stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants