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.

classification
Title: issubclass(NotSubclassOfObject, InstanceOfAbcMeta) fails instead of returning False
Type: Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: jyasskin Nosy List: gvanrossum, jyasskin
Priority: normal Keywords: patch

Created on 2008-01-06 22:46 by jyasskin, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
subclass_oldstyle.patch jyasskin, 2008-01-07 00:09
Messages (4)
msg59412 - (view) Author: Jeffrey Yasskin (jyasskin) * (Python committer) Date: 2008-01-06 22:46
Python 2.6a0 (trunk:59791M, Jan  6 2008, 12:22:37) 
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import abc
[30620 refs]
>>> class A:
...   __metaclass__ = abc.ABCMeta
... 
[30650 refs]
>>> class B:
...   pass
... 
[30659 refs]
>>> issubclass(B, A)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jyasskin/src/python/trunk-abc/Lib/abc.py", line 191, in
__subclasscheck__
    if cls in subclass.__mro__:
AttributeError: class B has no attribute '__mro__'
[30701 refs]
>>> 


This causes Decimal to break in interesting ways when I make it subclass
numbers.Real. test_abc doesn't catch it because it declares
__metaclass__=type at the top level. :-(

This looks relatively easy to fix, so I'll work on a patch.
msg59422 - (view) Author: Jeffrey Yasskin (jyasskin) * (Python committer) Date: 2008-01-07 00:09
This is certainly not the only way to fix this. Is it the best?
msg59426 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-01-07 02:42
lgtm
msg59433 - (view) Author: Jeffrey Yasskin (jyasskin) * (Python committer) Date: 2008-01-07 06:11
Committed as r59809.
History
Date User Action Args
2022-04-11 14:56:29adminsetgithub: 46088
2008-01-07 06:11:37jyasskinsetstatus: open -> closed
messages: + msg59433
2008-01-07 02:42:07gvanrossumsetresolution: accepted
messages: + msg59426
2008-01-07 00:09:23jyasskinsetkeywords: + patch
files: + subclass_oldstyle.patch
messages: + msg59422
title: isinstance(NotSubclassOfObject, InstanceOfAbcMeta) fails instead of returning False -> issubclass(NotSubclassOfObject, InstanceOfAbcMeta) fails instead of returning False
2008-01-06 23:18:30jyasskinlinkissue1623 dependencies
2008-01-06 22:46:33jyasskincreate