[Python-bugs-list] [ python-Bugs-454685 ] exec() and globals weirdness

noreply@sourceforge.net noreply@sourceforge.net
Thu, 23 Aug 2001 12:44:26 -0700


Bugs item #454685, was opened at 2001-08-23 12:44
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=454685&group_id=5470

Category: None
Group: Python 2.1.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: exec() and globals weirdness

Initial Comment:
The following program should print:

xyzzy
plugh

but instead it prints:

xyzzy
xyzzy

Program:

gunk = 'xyzzy'

def func():
    global gunk

    junk = 'plugh'
    exec('gunk = junk')

print gunk
func()
print gunk


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

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