Issue 14857: Direct access to lexically scoped class is broken in 3.3 (original) (raw)
Currently, class references from methods in 3.3 aren't being mapped correctly to the class currently being defined.
This goes against the documented behaviour of PEP 3135, which states explicitly that the new zero-argument form is equivalent to super(class, ), where class is the closure reference.
This breakage is almost certainly due to the fix for #12370
The fact the test suite didn't break is a sign we also have a gap in our test coverage.
Given that a workaround is documented in #12370, but there's no workaround for this breakage, reverting the fix for that issue may prove necessary (unlike that current breakage, at least that wouldn't be a regression from 3.2).
Ouch. The 'class' behavior is documented here too: http://docs.python.org/py3k/library/functions.html?highlight=class#super. Unfortunately I don't see any other documentation on the lexically scoped form of class.
As implied, cases like the following just don't work any longer:
class X(object): ... def init(self): ... super(class, self).init() ... X() Traceback (most recent call last): File "", line 1, in File "", line 3, in init NameError: global name 'class' is not defined
This worked fine in 3.2.