[Python-bugs-list] [ python-Bugs-407800 ] global in classdef affect nested scope!?

noreply@sourceforge.net noreply@sourceforge.net
Mon, 19 Mar 2001 16:26:00 -0800


Bugs item #407800, was updated on 2001-03-11 18:18
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=407800&group_id=5470

Category: Parser/Compiler
Group: None
>Status: Closed
Priority: 7
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Jeremy Hylton (jhylton)
Summary: global in classdef affect nested scope!?

Initial Comment:
[pedroni]
> (II)
> from __future__ import nested_scopes

> x='top'
> def ta():
>     x='ta'
>     class A:
>         global x
>         def tata(self):
>             return x # LOAD_GLOBAL
>     return A
>
> print ta()().tata() # -> 'top'
>
> should not the global decl in class scope be ignored 
and so x be
> bound to x in ta, resulting in 'ta' as output?

[Tim Peters]
Yes, this one is clearly a bug.  Good catch!



----------------------------------------------------------------------

>Comment By: Jeremy Hylton (jhylton)
Date: 2001-03-19 16:26

Message:
Logged In: YES 
user_id=31392

Fix in rev 2.188 of compile.c


----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2001-03-19 12:44

Message:
Logged In: YES 
user_id=31392

Oops!  Didn't mean to close this one.


----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2001-03-19 12:43

Message:
Logged In: YES 
user_id=31392

Fixed in rev. 2.187 of compile.c


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=407800&group_id=5470