[New-bugs-announce] [issue29944] Argumentless super() calls do not work in classes constructed with type()

assume_away report at bugs.python.org
Thu Mar 30 02:36:49 EDT 2017


New submission from assume_away:

The simplest example:

def mydec(cls):
    return type(cls.__name__, cls.__bases__, dict(cls.__dict__))

@mydec
class MyList(list):
    
    def extend(self, item):
        super(MyList, self).extend(item)
        
    def insert(self, index, object):
        super().insert(index, object)

>>> lst = MyList()
>>> lst.extend([2,3])
>>> lst.insert(0, 1)
TypeError: super(type, obj): obj must be an instance or subtype of type
>>> lst
[2, 3]

If this is intended behavior, at least the error message could be fixed.

----------
messages: 290823
nosy: assume_away
priority: normal
severity: normal
status: open
title: Argumentless super() calls do not work in classes constructed with type()
type: behavior
versions: Python 3.6

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


More information about the New-bugs-announce mailing list