Message188794
| Author |
benjamin.peterson |
| Recipients |
amaury.forgeotdarc, benjamin.peterson, brett.cannon, georg.brandl, gvanrossum, isoschiz, mark.dickinson, ncoghlan, pconnell, pitrou, ubershmekel |
| Date |
2013年05月09日.23:22:41 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1368141761.96.0.698986474442.issue17927@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年05月09日 23:22:42 | benjamin.peterson | set | recipients:
+ benjamin.peterson, gvanrossum, brett.cannon, georg.brandl, amaury.forgeotdarc, mark.dickinson, ncoghlan, pitrou, ubershmekel, pconnell, isoschiz |
| 2013年05月09日 23:22:41 | benjamin.peterson | set | messageid: <1368141761.96.0.698986474442.issue17927@psf.upfronthosting.co.za> |
| 2013年05月09日 23:22:41 | benjamin.peterson | link | issue17927 messages |
| 2013年05月09日 23:22:41 | benjamin.peterson | create |
|