Dominic Sacré, 29.01.2011 00:38:
> On Fri, Jan 28, 2011 at 11:40 AM, Robert Bradshaw wrote:
>> New candidate up at http://cython.org/release/Cython-0.14.1rc3.tar.gz
>
> Is it just me, or do the release candidates break isinstance() when
> testing against a tuple of multiple types? When I do isinstance(x,
> (Foo, Bar)) a Foo object will be recognized, but a Bar object will
> not. The same code used to work fine in older versions, including
> 0.14.

Yes, looks like a bug:

------------------
cdef class B:
     pass

cdef class C:
     pass

def test_custom_tuple(obj):
     """
     >>> test_custom_tuple(A())
     True
     >>> test_custom_tuple(B())
     True
     >>> test_custom_tuple(C())
     False
     """
     return isinstance(obj, (A,B))
------------------

Fails for B(), the second type check is simply dropped.

I'm looking into it.

Stefan
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to