[Numpy-discussion] typo in arrayobject.h?

christiaan.kok at philips.com christiaan.kok at philips.com
Tue Mar 18 00:32:07 CST 2003


Dear Konrad,


>There should be a semicolon there according to my understanding of C syntax!

>Check the C extension which you are compiling. It very probably defines
>PY_ARRAY_UNIQUE_SYMBOL to something before including arrayobject.h. I suspect
>that there is something wrong with that definition.

>Konrad.


According to my understanding of C there should indeed be a semicolon as well, but the C compiler gives a syntax errro warning. The first lines of my C code (which runs perfectly under Linux with gcc BTW) are as follows:


#include "c:\python22\include\Python.h"
#include "c:\python22\include\numeric\arrayobject.h"
#define PY_ARRAY_UNIQUE_SYMBOL
#include "libnumpy-access.h"

static PyObject* find_minimum(PyObject *self, PyObject *args){
........


Ok, I found the problem. Within libnumpy-access.h yet again arrayobject.h is called which causes the problem. So changing this to

#include "c:\python22\include\Python.h"
#include "c:\python22\include\numeric\arrayobject.h"
#include "libnumpy-access.h"
#define PY_ARRAY_UNIQUE_SYMBOL

static PyObject* find_minimum(PyObject *self, PyObject *args){
........

Now it works perfectly. Probably my code runs under linux anyway due to silly CR LF things which always bug multiplatform development.

Kudos to Fernando Perez because his libnumpy-access files make my code a lot more readable.

with best regards,

Christiaan Kok





More information about the Numpy-discussion mailing list