On Fri, Oct 23, 2009 at 3:22 PM, Stefan Behnel <[email protected]> wrote:
>
> Lisandro Dalcin wrote:
>> On Fri, Oct 23, 2009 at 11:25 AM, Stefan Behnel wrote:
>>> Lisandro Dalcin wrote:
>>>> Patch updated: 
>>>> http://trac.cython.org/cython_trac/attachment/ticket/417/typetest.diff
>>> Ah, yes, that's a smart way of doing it.
>>>
>>> Just one thing: are there cases where this may lead to multiple evaluation
>>> of the tested expression? I doubt it, since Python values tend to live in
>>> temp variables, but I'm not sure how this interacts with C function calls,
>>> for example.
>>>
>>
>> Can you provide a bit code about what you are talking? (then i could
>> integrate such cases in the test)
>
> I was thinking of ticket 404 that Robert fixed.
>
> http://trac.cython.org/cython_trac/ticket/404
>
> It might be worth adding a test like this:
>
>  cdef int count = 0
>
>  cdef object getFoo()
>      global count
>      count += 1
>      return Foo()
>
>  def test_getFoo():
>      cdef int old_count = count
>      cdef Foo x = getFoo()
>      return count - old_count
>
>  def test_getFooCast():
>      cdef int old_count = count
>      cdef Foo x = <Foo?>getFoo()
>      return count - old_count
>
>  >>> test_getFoo()
>  1
>  >>> test_getFooCast()
>  1
>
> Just add that and I'll happily await your commit.
>

http://hg.cython.org/cython-devel/rev/9f4f888a2b4e
http://hg.cython.org/cython-devel/rev/294a197230dd



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