Message168997
Sorry, I wasn't very clear. super() currently works by assuming that self is the first entry in f_localsplus, which is defeated, for example, by doing:
>>> class A:
... def f(self):
... del self
... super()
...
>>> A().f()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 4, in f
SystemError: super(): arg[0] deleted
>>> class B:
... def f(self):
... self = 1
... super()
...
>>> B().f()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 4, in f
TypeError: super(type, obj): obj must be an instance or subtype of type
I don't know if this is the intended behaviour (in which case, my assertion that obj is a tuple should be replaced by just checking whether it is a tuple and raising an exception otherwise; and I suppose the super documentation should mention this caveat), or whether this should be fixed somehow. |
|
Date |
User |
Action |
Args |
2012-08-24 11:19:18 | james.sanders | set | recipients:
+ james.sanders, amaury.forgeotdarc, ezio.melotti, r.david.murray |
2012-08-24 11:19:18 | james.sanders | set | messageid: <1345807158.4.0.172775075852.issue15753@psf.upfronthosting.co.za> |
2012-08-24 11:19:17 | james.sanders | link | issue15753 messages |
2012-08-24 11:19:17 | james.sanders | create | |
|