diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-03-01 06:09:34 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-03-01 06:09:34 (GMT) |
commit | 7889107be7cb5a28aabcdfa33778bdce3e9b5c27 (patch) | |
tree | 5fd51200881acad3410e05b2eb52e7204e23a8ec /install-sh | |
parent | a52e8fe49a625d13d89967bc17adeb71520bf3d0 (diff) | |
download | cpython-7889107be7cb5a28aabcdfa33778bdce3e9b5c27.zip cpython-7889107be7cb5a28aabcdfa33778bdce3e9b5c27.tar.gz cpython-7889107be7cb5a28aabcdfa33778bdce3e9b5c27.tar.bz2 |
Fix core dump in example from Samuele Pedroni:
from __future__ import nested_scopes
x=7
def f():
x=1
def g():
global x
def i():
def h():
return x
return h()
return i()
return g()
print f()
print x
This kind of code didn't work correctly because x was treated as free
in i, leading to an attempt to load x in g to make a closure for i.
Solution is to make global decl apply to nested scopes unless their is
an assignment. Thus, x in h is global.
Diffstat (limited to 'install-sh')
0 files changed, 0 insertions, 0 deletions