Message168997
| Author |
james.sanders |
| Recipients |
amaury.forgeotdarc, ezio.melotti, james.sanders, r.david.murray |
| Date |
2012年08月24日.11:19:17 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1345807158.4.0.172775075852.issue15753@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|