summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-03-22 02:32:48 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-03-22 02:32:48 (GMT)
commit061d106a0f56c5b4171ad8c56ecfaa6cefb27385 (patch)
tree5f8752ceddffe173d9bf0b6de2781cbfd67e8f08 /Python/ceval.c
parentf6e47ad4bd12ffa633d51071520722be32fb252d (diff)
downloadcpython-061d106a0f56c5b4171ad8c56ecfaa6cefb27385.zip
cpython-061d106a0f56c5b4171ad8c56ecfaa6cefb27385.tar.gz
cpython-061d106a0f56c5b4171ad8c56ecfaa6cefb27385.tar.bz2
If a code object is compiled with nested scopes, define the CO_NESTED flag.
Add PyEval_GetNestedScopes() which returns a non-zero value if the code for the current interpreter frame has CO_NESTED defined.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 156866f..658ccb2 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2667,6 +2667,14 @@ PyEval_GetRestricted(void)
}
int
+PyEval_GetNestedScopes(void)
+{
+ PyFrameObject *current_frame = PyThreadState_Get()->frame;
+ return current_frame == NULL ? 0 :
+ current_frame->f_code->co_flags & CO_NESTED;
+}
+
+int
Py_FlushLine(void)
{
PyObject *f = PySys_GetObject("stdout");
@@ -3448,7 +3456,7 @@ exec_statement(PyFrameObject *f, PyObject *prog, PyObject *globals,
else if (PyFile_Check(prog)) {
FILE *fp = PyFile_AsFile(prog);
char *name = PyString_AsString(PyFile_Name(prog));
- v = PyRun_File(fp, name, Py_file_input, globals, locals);
+ v = PyRun_File(fp, name, Py_file_input, globals, locals);
}
else {
char *str;