[issue29270] super call in ctypes sub-class fails in 3.6

Eryk Sun report at bugs.python.org
Sat Jan 14 06:35:41 EST 2017


Eryk Sun added the comment:

OK, this is completely broken and needs a more thoughtful solution than my simpleminded hack. Here's a practical example of the problem, tested in 3.5.2:

    class MyInt(ctypes.c_int):
        def __repr__(self):
            return super().__repr__()

    class Struct(ctypes.BigEndianStructure):
        _fields_ = (('i', MyInt),)

    >>> s = Struct()
    >>> s.i
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "<stdin>", line 3, in __repr__
    TypeError: super(type, obj): obj must be an instance or subtype of type

----------

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


More information about the Python-bugs-list mailing list