Skip to content

Commit

Permalink
net/py-maxminddb: fix C extension initialization refcounting and unwi…
Browse files Browse the repository at this point in the history
…nding
  • Loading branch information
rcmcdonald91 committed Jan 9, 2023
1 parent a9a3acd commit a21364e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/py-maxminddb/Makefile
@@ -1,5 +1,6 @@
PORTNAME= maxminddb
PORTVERSION= 2.2.0
PORTREVISION= 1
DISTVERSIONPREFIX= v
CATEGORIES= net python geography
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
Expand All @@ -13,14 +14,14 @@ LICENSE_FILE= ${WRKSRC}/LICENSE

LIB_DEPENDS= libmaxminddb.so:net/libmaxminddb

USES= compiler:c11 localbase python:3.6+
USES= compiler:c11 localbase python:3.7+
USE_GITHUB= yes
GH_ACCOUNT= maxmind
GH_PROJECT= MaxMind-DB-Reader-python

USE_PYTHON= autoplist distutils
USE_PYTHON= allflavors autoplist concurrent distutils

post-install:
${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/maxminddb/extension*.so
${FIND} ${STAGEDIR}${PYTHON_SITELIBDIR} -name '*.so' | ${XARGS} ${STRIP_CMD}

.include <bsd.port.mk>
10 changes: 10 additions & 0 deletions net/py-maxminddb/files/patch-extension_maxminddb.c
@@ -0,0 +1,10 @@
--- extension/maxminddb.c.orig 2023-01-09 13:42:35 UTC
+++ extension/maxminddb.c
@@ -737,6 +737,7 @@ PyMODINIT_FUNC PyInit_extension(void) {
if (PyType_Ready(&Metadata_Type)) {
return NULL;
}
+ Py_INCREF(&Metadata_Type);
PyModule_AddObject(m, "Metadata", (PyObject *)&Metadata_Type);

PyObject *error_mod = PyImport_ImportModule("maxminddb.errors");

0 comments on commit a21364e

Please sign in to comment.