[Cython] [mailinglist] Re: problems with external data
Stefan Behnel
stefan_ml at behnel.de
Fri Nov 14 13:26:09 CET 2008
Uwe Schmitt wrote:
> Uwe Schmitt schrieb:
>> Stefan Behnel schrieb:
>>> Uwe Schmitt wrote:
>>>> > I got a problem in the following situatino when wrapping
>>>> > some c code:
>>>> >
>>>> > file svdlib.h contains:
>>>> >
>>>> > extern char *SVDVersion;
>>>> > extern long SVDVerbosity;
>>>> >
>>>> > file svlib.pyx begins with:
>>>> >
>>>> > cdef extern from "svdlib.h" :
>>>> >
>>>> > cdef extern long SVDVerbosity
>>>> > cdef extern char * SVDVersion
>
> I'm using "print SVDVersion"
> and "print SVDVerbosity" which are translated as follows:
>
> /*
> "C:\cygwin\home\uschmitt\workspace_eclipse_ganymede\PySVDLIB\src\svdlibc.pyx":157
> * cdef SMat As
> *
> * SVDVerbosity = verbosity # <<<<<<<<<<<<<<
> * print SVDVerbosity
> * print SVDVersion
> */
> Py_INCREF(__pyx_v_verbosity);
> Py_DECREF(__pyx_v_SVDVerbosity);
> __pyx_v_SVDVerbosity = __pyx_v_verbosity;
Hmm, your code example is not very complete. An educated guess is that the
above code occurs inside a function, and the assignment to SVDVerbosity
makes it a local variable (normal Python behaviour). Since it hasn't been
declared, it has the normal Python object type.
I have no idea why you do this assignment, though. As I said, you could
help us in helping you by providing a relevant section of your code.
Stefan
More information about the Cython-dev
mailing list