On Fri, Oct 16, 2009 at 3:58 AM, Stefan Behnel <[email protected]> wrote:
>
> 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.
>

What did you meant with "exact" ? Subclasses should pass the typetest, right?

>
> http://trac.cython.org/cython_trac/ticket/417
>

Thanks.


-- 
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