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
Title: enable sqlite math functions on macos
Type: enhancement Stage: resolved
Components: Library (Lib), macOS Versions: Python 3.11
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: erlendaasland, lyinch, ned.deily, ronaldoussoren
Priority: normal Keywords: patch

Created on 2022-03-01 15:18 by lyinch, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 31635 closed lyinch, 2022-03-01 15:19
Messages (6)
msg414272 - (view) Author: lyinch (lyinch) * Date: 2022-03-01 15:18
Similar to these PRs: https://github.com/python/cpython/pull/24053/files and https://github.com/python/cpython/pull/25892/files which enable the built-in sqlite3 math functions for Windows, I want to have support for them on macos. As per the sqlite3 documentation: https://sqlite.org/releaselog/3_35_0.html this requires compilation with -DSQLITE_ENABLE_MATH_FUNCTIONS . On master, the flag is missing for macos : https://github.com/python/cpython/blob/main/Mac/BuildScript/build-installer.py#L364
msg414374 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2022-03-02 16:32
This is not needed. Quoting https://sqlite.org/compile.html#enable_math_functions:

    This option is automatically added to the Makefile by the configure script on unix platforms, unless the --disable-math option is used.
msg414375 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2022-03-02 16:32
Suggesting to close as "not a bug".
msg414376 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2022-03-02 16:34
Duplicate of bpo-42686.
msg414377 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2022-03-02 16:41
FTR, here's 3.10 and 3.11 on my Mac, using the official Python.org installers:

    $ python3.10
    Python 3.10.2 (v3.10.2:a58ebcc701, Jan 13 2022, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sqlite3
    >>> cx = sqlite3.connect(":memory:")
    >>> cx.execute("select sin('1')").fetchone()
    (0.8414709848078965,)

    $ python3.11
    Python 3.11.0a5 (v3.11.0a5:c4e4b91557, Feb  3 2022, 14:54:01) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sqlite3
    >>> cx = sqlite3.connect(":memory:")
    >>> cx.execute("select sin('1')").fetchone()
    (0.8414709848078965,)
msg414381 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2022-03-02 17:20
Thanks for the suggested PR. And thanks for noticing, Erlend! I should have checked with you first!

To reiterate what I noted on the PR, this (reduntant) change would only have affected the Pythons provided by the python.org macOS installers; this behavior doesn't necessarily apply to all macOS Pythons. In particular, it appears that the Apple-provided system libsqlite3 does not have this option enabled so if you are building Python on macOS you'd need to supply another version of libsqlite3, like from a third-party distributor (say MacPorts or Homebrew) or build it yourself.
History
Date User Action Args
2022-04-11 14:59:56adminsetgithub: 91045
2022-03-02 17:20:18ned.deilysetstatus: pending -> closed
resolution: not a bug -> works for me
messages: + msg414381

stage: patch review -> resolved
2022-03-02 16:41:02erlendaaslandsetstatus: open -> pending

messages: + msg414377
2022-03-02 16:34:56erlendaaslandsetstatus: pending -> open

messages: + msg414376
2022-03-02 16:32:30erlendaaslandsetstatus: open -> pending
resolution: not a bug
messages: + msg414375
2022-03-02 16:32:10erlendaaslandsetnosy: + erlendaasland
messages: + msg414374
2022-03-01 15:19:26lyinchsetkeywords: + patch
stage: patch review
pull_requests: + pull_request29757
2022-03-01 15:18:14lyinchcreate