This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年05月19日 14:52 by ncoghlan, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg161126 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年05月19日 14:52 | |
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__, <firstarg>), 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). |
|||
| msg161215 - (view) | Author: Meador Inge (meador.inge) * (Python committer) | Date: 2012年05月20日 16:12 | |
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 "<stdin>", line 1, in <module> File "<stdin>", line 3, in __init__ NameError: global name '__class__' is not defined This worked fine in 3.2. |
|||
| msg161702 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年05月27日 08:17 | |
New changeset bcb3b81853cc by Nick Coghlan in branch 'default': Tweak importlib._bootstrap to avoid zero-argument super so I can work on issue #14857 without breaking imports http://hg.python.org/cpython/rev/bcb3b81853cc New changeset 96ab78ef82a7 by Nick Coghlan in branch 'default': Close #14857: fix regression in references to PEP 3135 implicit __class__ closure variable. Reopens issue #12370, but also updates unittest.mock to workaround that issue http://hg.python.org/cpython/rev/96ab78ef82a7 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:30 | admin | set | nosy:
+ georg.brandl github: 59062 |
| 2012年05月27日 08:17:22 | python-dev | set | status: open -> closed nosy: + python-dev messages: + msg161702 resolution: fixed stage: test needed -> resolved |
| 2012年05月20日 16:12:59 | meador.inge | set | nosy:
+ meador.inge messages: + msg161215 |
| 2012年05月20日 14:32:44 | Arfrever | set | nosy:
+ Arfrever |
| 2012年05月20日 09:27:36 | daniel.urban | set | nosy:
+ daniel.urban |
| 2012年05月19日 14:52:09 | ncoghlan | create | |