[Pyrex] Bug in CoerceFromPyTypeNode in 0.9.5

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Jan 29 00:04:13 UTC 2007


Peter Johnson wrote:
> On Sun, 28 Jan 2007, Peter Johnson wrote:
> 
>>cdef extern from *:
>>    ctypedef enum foo:
>>        FOO
>>cdef void func():
>>    cdef foo x
>>    map = [FOO]
>>    x = map[0]
> 
> 
> Sorry for all the self-replies, but an explicit cast does indeed fix this:
>      x = <foo>map[0]
> 
> If the cast is indeed now required due to better type-strictness in 0.9.5, 
> maybe all what's really needed here is just to give an informative error 
> message rather than crashing.

Yes, the typecast is needed now, because I've made it use
the C++ rules for enum compatibility, which don't allow
turning an int into an enum implicitly.

But you should certainly get an error message instead
of a crash.

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiem!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+



More information about the Pyrex mailing list