Robert Bradshaw wrote: > On Oct 15, 2009, at 4:23 PM, Lisandro Dalcin wrote: > >> I've just realized that my code is broken in many places... >> >> Suppose I have >> >> cdef class MyClass: >> cdef int val >> >> now I do: >> >> cdef object o = None >> >> cdef int i = (<MyClass?>o).val >> >> >> And this does not fail, and then the "i" variable have garbage... >> >> Do we really need to allow 'None' when using "?" in the cast?? > > I was trying to think of a usecase and I really can't. I guess it's > just for consistency with > > cdef MyClass x = foo()
I agree that extension type casts should be exact and tested ones should fail for None. http://trac.cython.org/cython_trac/ticket/417 Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
