<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Uwe Schmitt schrieb:</tt>
<blockquote cite="mid:491D3D67.30105@mineway.de" type="cite">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<tt>Stefan Behnel schrieb:
</tt>
<blockquote cite="mid:491C718A.9050805@behnel.de" type="cite">
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 13px;" lang="x-western">
<pre wrap=""><tt>Uwe Schmitt wrote:
</tt></pre>
<blockquote type="cite">
<pre wrap=""><tt><span class="moz-txt-citetags">> </span>I got a problem in the following situatino when wrapping
<span class="moz-txt-citetags">> </span>some c code:
<span class="moz-txt-citetags">> </span>
<span class="moz-txt-citetags">> </span>file svdlib.h contains:
<span class="moz-txt-citetags">> </span>
<span class="moz-txt-citetags">> </span> extern char *SVDVersion;
<span class="moz-txt-citetags">> </span> extern long SVDVerbosity;
<span class="moz-txt-citetags">> </span>
<span class="moz-txt-citetags">> </span>file svlib.pyx begins with:
<span class="moz-txt-citetags">> </span>
<span class="moz-txt-citetags">> </span> cdef extern from "svdlib.h" :
<span class="moz-txt-citetags">> </span>
<span class="moz-txt-citetags">> </span> cdef extern long SVDVerbosity
<span class="moz-txt-citetags">> </span> cdef extern char * SVDVersion
<span class="moz-txt-citetags">> </span>
<span class="moz-txt-citetags">> </span>
<span class="moz-txt-citetags">> </span>If I study the generated C code, Cython
<span class="moz-txt-citetags">> </span>handles SVDVersion as a char*, but SVDVerbosity
<span class="moz-txt-citetags">> </span>as a PyObject*.
</tt></pre>
</blockquote>
<pre wrap=""><!----><tt>
Could you forward a section of your code and the corresponding generated C
code that shows this behaviour?
Stefan </tt></pre>
</div>
</blockquote>
<tt><br>
Good news: the problem disappeared after upgrading to Cython 0.10,<br>
</tt></blockquote>
<tt><br>
</tt><tt>Bad news: the error occured again, I do not know what happens..<br>
<br>
I'm using "print SVDVersion"<br>
and "print SVDVerbosity" which are translated as follows:<br>
<br>
</tt>
<blockquote><tt> /*
"C:\cygwin\home\uschmitt\workspace_eclipse_ganymede\PySVDLIB\src\svdlibc.pyx":157<br>
</tt><tt> * cdef SMat As<br>
</tt><tt> * <br>
</tt><tt> * SVDVerbosity = verbosity #
<<<<<<<<<<<<<<<br>
</tt><tt> * print SVDVerbosity<br>
</tt><tt> * print SVDVersion<br>
</tt><tt> */<br>
</tt><tt> Py_INCREF(__pyx_v_verbosity);<br>
</tt><tt> Py_DECREF(__pyx_v_SVDVerbosity);<br>
</tt><tt> __pyx_v_SVDVerbosity = __pyx_v_verbosity;<br>
<br>
</tt><tt> /*
"C:\cygwin\home\uschmitt\workspace_eclipse_ganymede\PySVDLIB\src\svdlibc.pyx":158<br>
</tt><tt> * <br>
</tt><tt> * SVDVerbosity = verbosity<br>
</tt><tt> * print SVDVerbosity #
<<<<<<<<<<<<<<<br>
</tt><tt> * print SVDVersion<br>
</tt><tt> * <br>
</tt><tt> */<br>
</tt><tt> __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1))
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno =
__LINE__; goto __pyx_L1_error;}<br>
</tt><tt> Py_INCREF(__pyx_v_SVDVerbosity);<br>
</tt><tt> PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_SVDVerbosity);<br>
</tt><tt> if (__Pyx_Print(((PyObject *)__pyx_1), 1) < 0)
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno =
__LINE__; goto __pyx_L1_error;}<br>
</tt><tt> Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;<br>
<br>
</tt><tt> /*
"C:\cygwin\home\uschmitt\workspace_eclipse_ganymede\PySVDLIB\src\svdlibc.pyx":159<br>
</tt><tt> * SVDVerbosity = verbosity<br>
</tt><tt> * print SVDVerbosity<br>
</tt><tt> * print SVDVersion #
<<<<<<<<<<<<<<<br>
</tt><tt> * <br>
</tt><tt> * if isinstance(A, scipy.sparse.spmatrix):<br>
</tt><tt> */<br>
</tt><tt> __pyx_1 = __Pyx_PyBytes_FromString(SVDVersion); if
(unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159;
__pyx_clineno = __LINE__; goto __pyx_L1_error;}<br>
</tt><tt> __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2))
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno =
__LINE__; goto __pyx_L1_error;}<br>
</tt><tt> PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);<br>
</tt><tt> __pyx_1 = 0;<br>
</tt><tt> if (__Pyx_Print(((PyObject *)__pyx_2), 1) < 0)
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno =
__LINE__; goto __pyx_L1_error;}<br>
</tt><tt> Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;<br>
<br>
</tt><tt> </tt><tt><br>
</tt></blockquote>
<tt>SVDVerbosity is declared as "PyObject *__pyx_v_SVDVerbosity;"<br>
SVDVersion is not declared at all, which is the behavior I expected.<br>
<br>
Greetings, Uwe<br>
</tt>
<pre class="moz-signature" cols="72"><tt>
</tt></pre>
</body>
</html>