-
-
Notifications
You must be signed in to change notification settings - Fork 12k
Closed
Description
Proposed new feature or change:
This is a follow-up to the conversation in PR #30128. I am opening a new issue to keep the discussion active and visible.
To summarize, PR #30128 addressed the bug in issue #30122 related to the compilation bug of the wrapper file when using SWIG 4.4. @mattip suggested creating a meson-based test to exercise the use of the import_array macro and help to detect future incompatibilities with SWIG.
I pointed out that such a test already exists in the NumPy's source:
$ swig --version | grep Version
SWIG Version 4.4.0
$ cd tools/swig/test/
$ make
swig -c++ -python Array.i
swig -c++ -python Farray.i
swig -c++ -python Vector.i
swig -c++ -python Matrix.i
swig -c++ -python Tensor.i
swig -c++ -python Fortran.i
swig -c++ -python Flat.i
./setup.py build_ext -i
Array_wrap.cxx: In function ‘int SWIG_mod_exec(PyObject*)’:
Array_wrap.cxx:8533:3: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
8533 | import_array();
| ^~~~~~~~~~~~
Farray_wrap.cxx: In function ‘int SWIG_mod_exec(PyObject*)’:
Farray_wrap.cxx:6485:3: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
6485 | import_array();
| ^~~~~~~~~~~~
Vector_wrap.cxx: In function ‘int SWIG_mod_exec(PyObject*)’:
Vector_wrap.cxx:9405:3: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
9405 | import_array();
| ^~~~~~~~~~~~
Matrix_wrap.cxx: In function ‘int SWIG_mod_exec(PyObject*)’:
Matrix_wrap.cxx:9028:3: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
9028 | import_array();
| ^~~~~~~~~~~~
Tensor_wrap.cxx: In function ‘int SWIG_mod_exec(PyObject*)’:
Tensor_wrap.cxx:9112:3: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
9112 | import_array();
| ^~~~~~~~~~~~
Fortran_wrap.cxx: In function ‘int SWIG_mod_exec(PyObject*)’:
Fortran_wrap.cxx:5414:3: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
5414 | import_array();
| ^~~~~~~~~~~~
Flat_wrap.cxx: In function ‘int SWIG_mod_exec(PyObject*)’:
Flat_wrap.cxx:5088:3: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
5088 | import_array();
| ^~~~~~~~~~~~Please note that the tests currently fail when SWIG 4.4 is used.
These tests can only be run if NumPy is installed on the system. Unfortunately, I do not know how to make then include the generated __multiarray_api.h file during the build instead of the system file.