[issue17853] class construction name resolution broken in functions

Ethan Furman report at bugs.python.org
Sat Apr 27 10:25:59 CEST 2013


Ethan Furman added the comment:

One more data point to truly demonstrate that something is wrong:

--------------------------------------------
--> def test():
...   class Season(Enum):
...     print(locals())
...     Season = locals()['Season']
...     print(locals())
...
--> test()
{'Season': <class 'aenum.Season'>, '__module__': '__main__', '__locals__': {...}}
{'Season': <class 'aenum.Season'>, '__module__': '__main__', '__locals__': {...}}
--------------------------------------------

Notice the class name space *did not change in any way* before and after setting 'Season' manually.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17853>
_______________________________________


More information about the Python-bugs-list mailing list