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

"sqlite3_enable_shared_cache" deprecation warning when compiling with macOS system SQLite3 #68652

Closed
vajrasky mannequin opened this issue Jun 18, 2015 · 9 comments
Closed
Labels
3.10 only security fixes extension-modules C modules in the Modules dir OS-mac type-feature A feature request or enhancement

Comments

@vajrasky
Copy link
Mannequin

vajrasky mannequin commented Jun 18, 2015

BPO 24464
Nosy @ronaldoussoren, @ned-deily, @berkerpeksag, @vajrasky, @erlend-aasland
PRs
  • bpo-38311: Avoid sqlite3_enable_shared_cache deprecation warning when building with the macOS system SQLite3 #16469
  • bpo-24464: Deprecate sqlite3.enable_shared_cache #24008
  • bpo-24464: Fix sqlite3.enable_shared_cache() deprecation wrapper #24170
  • Files
  • remove_warning_compile__sqlite.patch
  • 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 2021-01-06.00:37:33.186>
    created_at = <Date 2015-06-18.11:31:43.206>
    labels = ['extension-modules', 'OS-mac', 'type-feature', '3.10']
    title = '"sqlite3_enable_shared_cache" deprecation warning when compiling with macOS system SQLite3'
    updated_at = <Date 2021-01-09.11:26:02.168>
    user = 'https://github.com/vajrasky'

    bugs.python.org fields:

    activity = <Date 2021-01-09.11:26:02.168>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-01-06.00:37:33.186>
    closer = 'berker.peksag'
    components = ['Extension Modules', 'macOS']
    creation = <Date 2015-06-18.11:31:43.206>
    creator = 'vajrasky'
    dependencies = []
    files = ['39726']
    hgrepos = []
    issue_num = 24464
    keywords = ['patch']
    message_count = 9.0
    messages = ['245463', '245592', '245608', '353488', '353489', '376445', '384458', '384459', '384717']
    nosy_count = 5.0
    nosy_names = ['ronaldoussoren', 'ned.deily', 'berker.peksag', 'vajrasky', 'erlendaasland']
    pr_nums = ['16469', '24008', '24170']
    priority = 'low'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue24464'
    versions = ['Python 3.10']

    @vajrasky
    Copy link
    Mannequin Author

    vajrasky mannequin commented Jun 18, 2015

    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.

    @vajrasky vajrasky mannequin added the OS-mac label Jun 18, 2015
    @ronaldoussoren
    Copy link
    Contributor

    <https://www.sqlite.org/c3ref/enable_shared_cache.html\> appears to indicate that the function is deprecated on OSX 10.7 and iOS 5.0, but looking at the latest sources on sqlite.org 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.

    @ned-deily
    Copy link
    Member

    I agree with Ronald that the proposed patch should not be applied as is. For example, the Pythons installed by the current python.org 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.

    @ned-deily ned-deily changed the title Got warning when compiling sqlite3 module on Mac OSX Got warning when compiling sqlite3 module on Mac OS X Jun 21, 2015
    @ned-deily
    Copy link
    Member

    Now that this has come up again, it's worth noting Ronald's comment in msg295954 from duplicate bpo-30646:

    "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."

    @ned-deily ned-deily added 3.9 only security fixes build The build process and cross-build labels Sep 29, 2019
    @ned-deily ned-deily changed the title Got warning when compiling sqlite3 module on Mac OS X "sqlite3_enable_shared_cache" deprecation warning when compiling with macOS system SQLite3 Sep 29, 2019
    @ned-deily
    Copy link
    Member

    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.

    @erlend-aasland
    Copy link
    Contributor

    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?

    @berkerpeksag
    Copy link
    Member

    New changeset ddb5e11 by Erlend Egeberg Aasland in branch 'master':
    bpo-24464: Deprecate sqlite3.enable_shared_cache (GH-24008)
    ddb5e11

    @berkerpeksag
    Copy link
    Member

    It's now deprecated in 3.10.

    @berkerpeksag berkerpeksag added 3.10 only security fixes extension-modules C modules in the Modules dir and removed 3.9 only security fixes build The build process and cross-build OS-mac labels Jan 6, 2021
    @berkerpeksag berkerpeksag added type-feature A feature request or enhancement OS-mac labels Jan 6, 2021
    @berkerpeksag
    Copy link
    Member

    New changeset d16f617 by Erlend Egeberg Aasland in branch 'master':
    bpo-24464: Fix sqlite3.enable_shared_cache() deprecation wrapper (GH-24170)
    d16f617

    @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.10 only security fixes extension-modules C modules in the Modules dir OS-mac type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants