[issue20503] super behavioru and abstract base classes (either implementation or documentation/error message is wrong)

Gerrit Holl report at bugs.python.org
Mon Feb 3 16:36:42 CET 2014


New submission from Gerrit Holl:

When using an abstract base class, super(type, obj) throws a TypeError stating "obj must be an instance (...) of type", even though isinstance(obj, type) returns True.  I'm not sure what is supposed to happen here, but either the error message and the documentation for super would need to be reformulated, or there is an issue with the implementation, or I am misunderstanding something.

Python 3.3.3 (default, Dec 12 2013, 11:13:02) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numbers
>>> super(numbers.Number, 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: super(type, obj): obj must be an instance or subtype of type
>>> isinstance(0, numbers.Number)
True

----------
components: Interpreter Core
messages: 210141
nosy: Gerrit.Holl
priority: normal
severity: normal
status: open
title: super behavioru and abstract base classes (either implementation or documentation/error message is wrong)
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20503>
_______________________________________


More information about the Python-bugs-list mailing list