diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-03-01 22:59:14 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-03-01 22:59:14 (GMT) |
commit | 9f324e964e06c79f9c47501afa12b1af4cb1a75f (patch) | |
tree | 1042e0c0f358ed8130f826fbf28b95e88921df3f /Include/compile.h | |
parent | 0f6b3832b9a0397910308f22f75f8449c4f492d8 (diff) | |
download | cpython-9f324e964e06c79f9c47501afa12b1af4cb1a75f.zip cpython-9f324e964e06c79f9c47501afa12b1af4cb1a75f.tar.gz cpython-9f324e964e06c79f9c47501afa12b1af4cb1a75f.tar.bz2 |
Useful future statement support for the interactive interpreter
(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().
Diffstat (limited to 'Include/compile.h')
-rw-r--r-- | Include/compile.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Include/compile.h b/Include/compile.h index 45854e9..deb8ee8 100644 --- a/Include/compile.h +++ b/Include/compile.h @@ -57,6 +57,8 @@ typedef struct { } PyFutureFeatures; DL_IMPORT(PyFutureFeatures *) PyNode_Future(struct _node *, char *); +DL_IMPORT(PyCodeObject *) PyNode_CompileFlags(struct _node *, char *, + PyCompilerFlags *); #define NESTED_SCOPES_DEFAULT 0 #define FUTURE_NESTED_SCOPES "nested_scopes" |