[SciPy-dev] patch to fix numpy PyArray_GetNDArrayCVersion() implementation

Andrew Straw strawman at astraw.com
Sun Jan 22 18:58:18 EST 2006


With current NumPy, the following file will no longer compile as C++:

#include "Python.h"
#include <X11/Xlib.h>
#define PY_ARRAY_TYPES_PREFIX SomeUnlikelyString
#include "numpy/arrayobject.h"

Here's an extract from the build log:

building 'numpy_bool_redefinition.test' extension
gcc options: '-pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes -fPIC'
compile options:
'-I/home/astraw/py24-amd64/lib/python2.4/site-packages/numpy-0.9.5.1980-py2.4-linux-x86_64.egg/numpy/core/include
-I/usr/include/python2.4 -I/home/astraw/py24-amd64/include/python2.4
-I/usr/include/python2.4 -c'
gcc: src/test.cpp
In file included from src/test.cpp:3:
/home/astraw/py24-amd64/lib/python2.4/site-packages/numpy-0.9.5.1980-py2.4-linux-x86_64.egg/numpy/core/include/numpy/arrayobject.h:110:
error: redeclaration
   of C++ built-in type `int'
In file included from src/test.cpp:3:
/home/astraw/py24-amd64/lib/python2.4/site-packages/numpy-0.9.5.1980-py2.4-linux-x86_64.egg/numpy/core/include/numpy/arrayobject.h:110:
error: redeclaration
   of C++ built-in type `int'

I don't pretend to completely understand what's going on, but it seems
to involve the numpy/C++ naming magic of "uint". If I change the
function definition to "unsigned int" in
numpy/core/src/multiarraymodule.c, the issue is gone.

Let me know if more info/testing is needed...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NDArrayCVersion.patch
Type: text/x-patch
Size: 457 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20060122/d81fc922/attachment.bin>


More information about the SciPy-Dev mailing list