[issue19979] Missing nested scope vars in class scope (bis)

2018-07-25 Thread Tal Einat
Tal Einat added the comment: This does indeed seem to be a duplicate of issue9226. -- nosy: +taleinat resolution: -> duplicate stage: test needed -> resolved status: pending -> closed superseder: -> erroneous behavior when creating classes inside a closure __

[issue19979] Missing nested scope vars in class scope (bis)

2018-03-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This looks like a duplicate of issue9226. -- nosy: +serhiy.storchaka status: open -> pending ___ Python tracker ___

[issue19979] Missing nested scope vars in class scope (bis)

2015-07-21 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: -ethan.furman ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue19979] Missing nested scope vars in class scope (bis)

2015-06-20 Thread Nick Coghlan
Nick Coghlan added the comment: With the fact that the existence of "Python without closures" predates Python 2.2, this now reads like a straight up compiler bug to me. Compare the behaviour with no local assignment in the class body: >>> def f(): ... n = 1 ... class C: ... pri

[issue19979] Missing nested scope vars in class scope (bis)

2014-05-19 Thread Armin Rigo
Armin Rigo added the comment: Terry: I meant exactly what I wrote, and not some unrelated examples: def f(): n = 1 class A: n = n doesn't work, but the same two lines ("n = 1"; "class A: n = n") work if written at module level instead of in a function. --

[issue19979] Missing nested scope vars in class scope (bis)

2014-05-18 Thread Ethan Furman
Ethan Furman added the comment: Terry remarked: --- > I am puzzled by the opening statement there that > > from enum import Enum # I added this as necessary > class Season(Enum): > SPRING = Season() > > "works beautifully" at top level as it indeed raises > NameError: name

[issue19979] Missing nested scope vars in class scope (bis)

2014-05-18 Thread Terry J. Reedy
Terry J. Reedy added the comment: #17853 was in the context of metaclasses. Even so, I am puzzled by the opening statement there that from enum import Enum # I added this as necessary class Season(Enum): SPRING = Season() "works beautifully" at top level as it indeed raises NameError: nam

[issue19979] Missing nested scope vars in class scope (bis)

2014-05-18 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue19979] Missing nested scope vars in class scope (bis)

2013-12-23 Thread Terry J. Reedy
Terry J. Reedy added the comment: As near as I can tell, "class A: n = n" currently works the same at module and nested scope, the latter with or without nonlocal n. >>> class A: n=n [...] NameError: name 'n' is not defined >>> def f(): class A: n=n >>> f() [...] NameError: na

[issue19979] Missing nested scope vars in class scope (bis)

2013-12-13 Thread Armin Rigo
New submission from Armin Rigo: This is a repeat of the old issue 532860: "NameError assigning to class in a func". It is about class statements' variable lookups, which has different behavior at module level or in a nested scope: def f(n): class A: n = n # doesn't work, tries