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

2017-03-30 Thread Nick Coghlan
Nick Coghlan added the comment: Right, there's a very similar instance-method-reuse related problem described in http://bugs.python.org/issue29270, where ctypes re-uses a class namespace is define a swapped-endianness version of the originally defined class. The easiest place to deflect confli

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

2017-03-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is what I get for leaving a response up and working on it intermittently for three hours, and not rechecking: I found the same basic problem. For the record, I also found a terribly hacky way of doing this sort of rebinding manually, should you actually n

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

2017-03-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: It looks like this is a general problem caused by the fact that a function that is: 1. Defined in a class 2. References the name "super" (even if it's a local variable name, even if it's never called) isn't "just" a plain function. Even though Python 3 offici

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

2017-03-30 Thread Nick Coghlan
Nick Coghlan added the comment: Interestingly, even `types.new_class` misbehaves in this case: ``` >>> def mydec(cls): ... return types.new_class(cls.__name__, cls.__bases__, exec_body=lambda ns: ns.update(cls.__dict__)) ... >>> @mydec ... class MyList(list): ... def insert(self, idx,

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

2017-03-30 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +ncoghlan, xiang.zhang ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

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

2017-03-29 Thread assume_away
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): supe