Benjamin Peterson added the comment:
Consider the following testcase
class X:
def meth(self):
print(self)
super()
def f():
k = X()
def g():
return k
return g
c = f().__closure__[0]
X.meth(c)
With patch
$ ./python unboxing.py
<cell at 0x7fddacab1eb8: X object at 0x7fddac7876d8>
Without patch
$ ./python unboxing.py
<cell at 0x7f2d0a218eb8: X object at 0x7f2d09eee6d8>
Traceback (most recent call last):
File "x.py", line 12, in <module>
X.meth(c)
File "x.py", line 4, in meth
super()
TypeError: super(type, obj): obj must be an instance or subtype of type
Maybe you don't care. OTOH, perhaps it could be fixed by checking if the first
argument is in fact a closure in super().
In the best world, super() would be syntax instead of a call, and we would just
push the __class__ the closure and first argument in the interpreter loop.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17927>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com