homepage

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.

classification
Title: cpython 3.3, __class__ missing.
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, ideasman42, r.david.murray
Priority: normal Keywords:

Created on 2011年07月11日 04:47 by ideasman42, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Messages (5)
msg140099 - (view) Author: Campbell Barton (ideasman42) * Date: 2011年07月11日 04:47
In python 3.2 this works and prints <class '__main__.Test'>,
in cpython hg: 71296:ab162f925761 it fails with:
 NameError: global name '__class__' is not defined
Since this change is not documented I assume its a bug.
--- snip ---
class Test:
 def __init__(self): print(__class__)
msg140100 - (view) Author: Campbell Barton (ideasman42) * Date: 2011年07月11日 04:48
checked for docs here:
http://docs.python.org/dev/whatsnew/3.3.html 
msg140101 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011年07月11日 04:54
No, this is consistent (again) with Python 2.
msg140103 - (view) Author: Campbell Barton (ideasman42) * Date: 2011年07月11日 06:34
Shouldn't it be documented that it changes still? - since people are using pytjon3.2 and its a stable release, _any_ breaking change should be documented IMHO
msg140107 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011年07月11日 11:28
Unless you can point to a place where the behavior that was fixed is actually documented, this is classed as an implementation detail that was changed (or, more likely, a bug that was fixed). If this were less obscure or had been in existence for longer, there might be an argument for documenting it, but I'm surprised that anyone noticed this variable, since its existence is not in keeping with how Python works in general. In fact, it goes completely against my Python intuition that it worked at all. (I suppose that someone newer to Python would be more likely to find it by accident...)
That said, it is certainly not obvious from Misc/NEWS that this variable went away, so it was presumably fixed as part of some other change. Given that we *do* have a bug report about it, we should consider if it should be documented somewhere; perhaps an addendum to the relevant Misc/NEWS entry, and then the What's New author can decide whether or not to include it.
(As an aside, note that What's New is not kept up to date, it generally only gets filled in closer to the release date.)
History
Date User Action Args
2022年04月11日 14:57:19adminsetgithub: 56739
2011年07月11日 11:28:01r.david.murraysetnosy: + r.david.murray
messages: + msg140107
2011年07月11日 06:34:57ideasman42setmessages: + msg140103
2011年07月11日 04:54:22benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg140101

resolution: not a bug
2011年07月11日 04:48:45ideasman42setmessages: + msg140100
2011年07月11日 04:47:56ideasman42create

AltStyle によって変換されたページ (->オリジナル) /