Mercurial > cpython-lru_cache-weakref
diff Include/pythonrun.h @ 16916:b0456d3a0f1f legacy-trunk
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().
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Thu, 01 Mar 2001 22:59:14 +0000 |
| parents | aa844711463a |
| children | 2054cea38754 |
line wrap: on
line diff
--- a/Include/pythonrun.h Thu Mar 01 22:56:17 2001 +0000 +++ b/Include/pythonrun.h Thu Mar 01 22:59:14 2001 +0000 @@ -7,6 +7,10 @@ extern "C" { #endif +typedef struct { + int cf_nested_scopes; +} PyCompilerFlags; + DL_IMPORT(void) Py_SetProgramName(char *); DL_IMPORT(char *) Py_GetProgramName(void); @@ -26,6 +30,7 @@ DL_IMPORT(int) PyRun_SimpleFile(FILE *, char *); DL_IMPORT(int) PyRun_SimpleFileEx(FILE *, char *, int); DL_IMPORT(int) PyRun_InteractiveOne(FILE *, char *); +DL_IMPORT(int) PyRun_InteractiveOneFlags(FILE *, char *, PyCompilerFlags *); DL_IMPORT(int) PyRun_InteractiveLoop(FILE *, char *); DL_IMPORT(struct _node *) PyParser_SimpleParseString(char *, int);
