• Jeremy Hylton's avatar
    Fix core dump in example from Samuele Pedroni: · 7889107b
    Jeremy Hylton yazdı
    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.
    7889107b
Adı
Son kayıt (commit)
Son güncelleme
Demo Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Python Loading commit data...
Tools Loading commit data...
.cvsignore Loading commit data...
.hgtags Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README Loading commit data...
acconfig.h Loading commit data...
config.h.in Loading commit data...
configure Loading commit data...
configure.in Loading commit data...
install-sh Loading commit data...
setup.py Loading commit data...