[Cython] [Bug] Coercion of struct constructor nodes

Carlos Pita carlosjosepita at gmail.com
Mon Apr 6 00:49:17 CEST 2015


Hi all,

f and g below should behave identically, shouldn't them?

import cython

cdef struct Point:
    int x
    int y

def f():
    return Point(x=10, y=10)

def g():
    cdef Point p = Point(x=10, y=10)
    return p


But then f won't compile:

 Cannot interpret dict as type 'Python object'

DictNode.coerce_to decides it can't coerce a CStructOrUnionType to a
python object, but the underlying struct type does know how to coerce
a struct into a dict.

Here is an old post stating the same, although I don't know if it ever
entered the bug tracker.

https://www.mail-archive.com/cython-dev@codespeak.net/msg09121.html

Best regards
--
Carlos


More information about the cython-devel mailing list