James added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15753>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to