[ python-Bugs-999042 ] Compiler module doesn't handle global statement correctly

SourceForge.net noreply at sourceforge.net
Wed Jul 28 16:01:33 CEST 2004


Bugs item #999042, was opened at 2004-07-27 22:15
Message generated for change (Settings changed) made by dcjim
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=999042&group_id=5470

Category: Python Library
>Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Jim Fulton (dcjim)
Assigned to: Nobody/Anonymous (nobody)
Summary: Compiler module doesn't handle global statement correctly

Initial Comment:
If we don't use the compiler module:

>>> code = 'global x\nx=1'
>>> d1={'__builtins__': {}}; d2={}; exec code in d1, d2
>>> d1, d2
({'__builtins__': {}, 'x': 1}, {})

with the compiler module:

>>> code = compiler.compile('global x\nx=1', 'd', 'exec') 
>>> d1={'__builtins__': {}}; d2={}; exec code in d1, d2
>>> d1, d2
({'__builtins__': {}}, {'x': 1})

global is ignored

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

Comment By: Jim Fulton (dcjim)
Date: 2004-07-28 14:01

Message:
Logged In: YES 
user_id=73023

Also in 2.3

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

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


More information about the Python-bugs-list mailing list