Note however that in my own code I use this:

cdef extern from "Python.h":
    ctypedef struct PyObject


In general, typedef'ing things to void* is a really bad idea, I always
try hard to avoid it. See the code below, Cython will (correctly) not
complain

cdef extern from "header.h":
   ctypedef void PyObject
   void Py_INCREF(PyObject*)

cdef int value = 0

Py_INCREF(&value)



On Thu, May 14, 2009 at 10:31 AM, Dag Sverre Seljebotn
<[email protected]> wrote:
> Dag Sverre Seljebotn wrote:
>> Robert wrote:
>>> Is there any reason to even allow this (other than to be backwards
>>> compatible with broken code). I think we should allow object <-->
>>> void*, or object <--> PyObject*, but no others. (One would then be
>>> forced to do <double*><void*>arr.data if one *really* wanted to.)
>>
>> Excellent idea!; and as you say should not break code. I'll do this for
>> 0.11.2.
>
> Done, however there's a slight issue: There's no canonical PyObject.
>
> If somebody has defined it as an empty struct, say, they now have
> problems (but a very helpful error is raised when compiling so it's OK).
> The ones we ship in Includes/ use "ctypedef void PyObject", and they
> still work (as it ends up as void*).
>
> I also removed the warning that used to be emitted for the specific
> cases of <void*>pyobj and <object>voidp.
>
> --
> Dag Sverre
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
>



-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to