classification
Title: abc.py:ABCMeta.__instancecheck__ broken for old style classes
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: jyasskin, schmir
Priority: normal Keywords:

Created on 2008-03-17 10:49 by schmir, last changed 2008-03-17 16:38 by jyasskin. This issue is now closed.

Messages (3)
msg63630 - (view) Author: Ralf Schmitt (schmir) Date: 2008-03-17 10:49
The following short program raises an exception:

import UserList

class C:
    pass
   
print isinstance(C, UserList.UserList)

---------
exception:
Traceback (most recent call last):
  File "t.py", line 6, in <module>
    print isinstance(C, UserList.UserList)
  File "/home/ralf/py26/lib/python2.6/abc.py", line 120, in
__instancecheck__
    subclass = instance.__class__
AttributeError: class C has no attribute '__class__'

If I use a new style class it works.
msg63631 - (view) Author: Ralf Schmitt (schmir) Date: 2008-03-17 10:55
I used svn revision 61433.
msg63670 - (view) Author: Jeffrey Yasskin (jyasskin) * (Python committer) Date: 2008-03-17 16:38
Missed this. It's now fixed by r61438.
History
Date User Action Args
2008-03-17 16:38:16jyasskinsetstatus: open -> closed
type: crash -> behavior
messages: + msg63670
nosy: + jyasskin
2008-03-17 10:55:20schmirsetmessages: + msg63631
2008-03-17 10:49:26schmircreate