• Jeremy Hylton's avatar
    Useful future statement support for the interactive interpreter · 9f324e96
    Jeremy Hylton yazdı
    (Also remove warning about module-level global decl, because we can't
    distinguish from code passed to exec.)
    
    Define PyCompilerFlags type contains a single element,
    cf_nested_scopes, that is true if a nested scopes future statement has
    been entered at the interactive prompt.
    
    New API functions:
        PyNode_CompileFlags()
        PyRun_InteractiveOneFlags()
        -- same as their non Flags counterparts except that the take an
           optional PyCompilerFlags pointer
    
    compile.c: In jcompile() use PyCompilerFlags argument.  If
        cf_nested_scopes is true, compile code with nested scopes.  If it
        is false, but the code has a valid future nested scopes statement,
        set it to true.
    
    pythonrun.c: Create a new PyCompilerFlags object in
        PyRun_InteractiveLoop() and thread it through to
        PyRun_InteractiveOneFlags().
    9f324e96
pythonrun.c 29.2 KB