databases/py-sqlite3 cannot load extensions (with patch)

From: Andrew_Šveikauskas <a.l.sveikauskas_at_gmail.com>
Date: Fri, 07 Aug 2026 17:55:00 UTC
Hi,

This address was listed as the maintainer for databases/py-sqlite3.  Sorry
if this is not the place to drop this.  (Tried the bugzilla but it isn't
working for me now.)  I was playing with this port and I found it doesn't
allow loading sqlite extension .so files.  This is easily verifiable even
without an extension by the following snippet throwing exceptions:

import sqlite3
conn = sqlite3.connect(":memory:")
conn.enable_load_extension(True)

Looking at the port I found that nothing was setting the C macro
PY_SQLITE_ENABLE_LOAD_EXTENSION.  This is normally set by the python
configure script, which gets bypassed for this port.

I was able to re-enable the functionality with the attached patch.

Regards,
Andrew

--- ports/databases/py-sqlite3/files/setup.py.old       2026-08-07 10:3
4:47.804089000 -0700
+++ ports/databases/py-sqlite3/files/setup.py   2026-08-07 10:32:55.042
227000 -0700
@@ -9,7 +9,7 @@
             prefix + "/include"]
 lib_dirs = [prefix + "/lib"]
 libs = ["sqlite3"]
-macros = [('MODULE_NAME', '"sqlite3"')]
+macros = [('MODULE_NAME', '"sqlite3"'), ('PY_SQLITE_ENABLE_LOAD_EXTENS
ION', 1)]
 sqlite_srcs = [
 '_sqlite/connection.c',
 '_sqlite/cursor.c',