Bug 265537

Summary: databases/py-sqlite3: Fails to load with lang/python311: _sqlite3.cpython-311.so: Undefined symbol "pysqlite_close_all_blobs"
Product: Ports & Packages Reporter: Fukang Chen <loader>
Component: Individual Port(s)Assignee: Fukang Chen <loader>
Status: Closed FIXED    
Severity: Affects Some People CC: loader, python
Priority: --- Keywords: needs-patch
Version: LatestFlags: bugzilla: maintainer-feedback? (python)
loader: merge-quarterly?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch
koobs: maintainer-approval-
patch loader: maintainer-approval?

Description Fukang Chen freebsd_committer freebsd_triage 2022-07-31 16:21:31 UTC
Created attachment 235584 [details]
patch

% python3.11 -c 'import sqlite3'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.11/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.11/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: /usr/local/lib/python3.11/lib-dynload/_sqlite3.cpython-311.so: Undefined symbol "pysqlite_close_all_blobs"

_sqlite/blob.c was introduced by this commit and only affects lang/python311
https://github.com/python/cpython/commit/ee475430d431814cbb6eb5e8a6c0ae51943349d4
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2022-08-08 00:21:12 UTC
Thanks Fukang. 

- Any open issues/pr's for this issue? If so please reference in patch as a comment
- If not, anything need to be sent upstream?
- Is quarterly affected? If so, please MFH in commit log message, merge and track here
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2022-08-08 00:21:47 UTC
I see you've included MFH: in patch, disregard earlier comment :)
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2022-08-08 00:23:10 UTC
Since this is a runtime error, PORTREVISION needs to be bumped so that the module is rebuilt.
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2022-08-08 00:24:03 UTC
Comment on attachment 235584 [details]
patch

Needs changes: Bump PORTREVISION to force rebuild as this is a runtime issue
Comment 5 Fukang Chen freebsd_committer freebsd_triage 2022-08-08 11:55:50 UTC
Created attachment 235772 [details]
patch

Thanks koobs.
Comment 6 Fukang Chen freebsd_committer freebsd_triage 2022-08-08 12:00:06 UTC
(In reply to Kubilay Kocak from comment #1)
> - If not, anything need to be sent upstream?

databases/py-sqlite3 uses a customized setup.py which is only available in FreeBSD ports,
upstream is not affected.
Comment 7 Dmitry Marakasov freebsd_committer freebsd_triage 2022-10-31 19:32:01 UTC
Please land this ASAP. The fix is confirmed.

> Needs changes: Bump PORTREVISION to force rebuild as this is a runtime issue

In fact it does not, it's a build time only issue.
Comment 8 commit-hook freebsd_committer freebsd_triage 2022-11-01 11:25:39 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=561c2dbebb6fd1c52a580de6846de686a1b743c4

commit 561c2dbebb6fd1c52a580de6846de686a1b743c4
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2022-11-01 11:20:26 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2022-11-01 11:24:35 +0000

    databases/py-sqlite3: fix build with python 3.11

    While here, add a simple smoke test which catches this kind of
    problems and silence stripping.

    PR:             265537
    Submitted by:   loader@FreeBSD.org
    Approved by:    maintainer timeout (2+ months)

 databases/py-sqlite3/Makefile        | 5 ++++-
 databases/py-sqlite3/files/setup3.py | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)