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

SourceForge.net noreply at sourceforge.net
Sat Apr 30 00:04:58 CEST 2005


Bugs item #999042, was opened at 2004-07-27 22:15
Message generated for change (Comment added) made by dsuch
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: Darek Suchojad (dsuch)
Date: 2005-04-29 22:04

Message:
Logged In: YES 
user_id=954779

Hi, I have submitted a simple fix some time ago
python.org/sf/1090482, do you think it is correct?

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

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