[SciPy-dev] patch to fix numpy PyArray_GetNDArrayCVersion() implementation
Andrew Straw
strawman at astraw.com
Mon Jan 23 22:08:59 EST 2006
OK, since no one seems to be biting, let me include the full source and
setup.py so that anyone can see the problem by doing a simple "python
setup.py build".
Andrew Straw wrote:
>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...
>
>
>------------------------------------------------------------------------
>
>Index: numpy/core/src/multiarraymodule.c
>===================================================================
>--- numpy/core/src/multiarraymodule.c (revision 1980)
>+++ numpy/core/src/multiarraymodule.c (working copy)
>@@ -5112,8 +5112,8 @@
> /*MULTIARRAY_API
> GetNDArrayCVersion
> */
>-static uint
>+static unsigned int
> PyArray_GetNDArrayCVersion(void)
> {
>- return (uint)NDARRAY_VERSION;
>+ return (unsigned int)NDARRAY_VERSION;
> }
>
> static char
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Scipy-dev mailing list
>Scipy-dev at scipy.net
>http://www.scipy.net/mailman/listinfo/scipy-dev
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: numpy_bool_redefinition.tar.gz
Type: application/x-tar
Size: 495 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20060123/a22c4f12/attachment.tar>
More information about the SciPy-Dev
mailing list