This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rgammans
Recipients rgammans
Date 2010-01-03.19:13:31
SpamBayes Score 2.4640482e-08
Marked as misclassified No
Message-id <1262546013.12.0.84768475199.issue7624@psf.upfronthosting.co.za>
In-reply-to
Content
The following sequence causes isinstance to raise an exception rather than to return False.

>>> class foo:
...     pass
... 
>>> import collections
>>> isinstance(foo,collections.Callable)
True
>>> isinstance(foo(),collections.Callable)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/abc.py", line 131, in __instancecheck__
    return (cls.__subclasscheck__(subclass) or
  File "/usr/lib/python2.6/abc.py", line 147, in __subclasscheck__
    ok = cls.__subclasshook__(subclass)
  File "/usr/lib/python2.6/_abcoll.py", line 117, in __subclasshook__
    if any("__call__" in B.__dict__ for B in C.__mro__):
AttributeError: class foo has no attribute '__mro__'
>>>
History
Date User Action Args
2010-01-03 19:13:33rgammanssetrecipients: + rgammans
2010-01-03 19:13:33rgammanssetmessageid: <1262546013.12.0.84768475199.issue7624@psf.upfronthosting.co.za>
2010-01-03 19:13:31rgammanslinkissue7624 messages
2010-01-03 19:13:31rgammanscreate