Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 05 Apr 2026 14:51:35 +0000
From:      Charlie Li <vishwin@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 634b014274a6 - main - math/py-numpy1: restore mistakenly removed patch
Message-ID:  <69d276f7.3cde4.7924c98d@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by vishwin:

URL: https://cgit.FreeBSD.org/ports/commit/?id=634b014274a6dc38252bc1239007da72664307a5

commit 634b014274a6dc38252bc1239007da72664307a5
Author:     Charlie Li <vishwin@FreeBSD.org>
AuthorDate: 2026-04-05 14:48:44 +0000
Commit:     Charlie Li <vishwin@FreeBSD.org>
CommitDate: 2026-04-05 14:51:30 +0000

    math/py-numpy1: restore mistakenly removed patch
    
    Leads to breakages like math/py-nlopt:
    
    [ 98%] Building CXX object extern/nlopt/src/swig/CMakeFiles/nlopt_python.dir/CMakeFiles/nlopt_python.dir/nloptPYTHON_wrap.cxx.o
    /wrkdirs/usr/ports/math/py-nlopt/work-py311/nlopt-python-2.9.1/build/temp.freebsd-14.3-RELEASE-p10-i386-cpython-311/extern/nlopt/src/swig/CMakeFiles/nlopt_python.dir/nloptPYTHON_wrap.cxx:15325:3: error: cannot initialize return object of type 'int' with an rvalue of type 'std::nullptr_t'
     15325 |   import_array();
           |   ^~~~~~~~~~~~~~
    /usr/local/lib/python3.11/site-packages/numpy/core/include/numpy/__multiarray_api.h:1558:151: note: expanded from macro 'import_array'
     1558 | #define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NULL; } }
          |                                                                                                                                                       ^~~~
    /usr/include/sys/_null.h:35:14: note: expanded from macro 'NULL'
       35 | #define NULL    nullptr
          |                 ^~~~~~~
    1 error generated.
    
    Reported by: diizzy, fallout
---
 math/py-numpy1/Makefile           |  2 +-
 math/py-numpy1/files/patch-swig44 | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/math/py-numpy1/Makefile b/math/py-numpy1/Makefile
index e5da822501f8..ed36c1a44980 100644
--- a/math/py-numpy1/Makefile
+++ b/math/py-numpy1/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	numpy
 DISTVERSION=	1.26.4
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	math python
 MASTER_SITES=	PYPI \
 		https://numpy.org/doc/${DISTVERSION:R}/:doc
diff --git a/math/py-numpy1/files/patch-swig44 b/math/py-numpy1/files/patch-swig44
new file mode 100644
index 000000000000..4b0cd4694c85
--- /dev/null
+++ b/math/py-numpy1/files/patch-swig44
@@ -0,0 +1,19 @@
+Reference:	https://github.com/numpy/numpy/commit/1e424dae42a2d560520b6e053e8e60ac4205bfc7
+
+--- numpy/core/code_generators/generate_numpy_api.py.orig	2024-02-05 21:17:48 UTC
++++ numpy/core/code_generators/generate_numpy_api.py
+@@ -118,7 +118,13 @@ _import_array(void)
+   return 0;
+ }
+ 
+-#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NULL; } }
++#if (SWIG_VERSION < 0x040400)
++#define _RETURN_VALUE NULL
++#else
++#define _RETURN_VALUE 0
++#endif
++
++#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return _RETURN_VALUE; } }
+ 
+ #define import_array1(ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return ret; } }
+ 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69d276f7.3cde4.7924c98d>