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.
This commit is contained in:
Jeremy Hylton 2001-03-22 02:32:48 +00:00
parent f6e47ad4bd
commit 061d106a0f
4 changed files with 13 additions and 1 deletions

View file

@ -2666,6 +2666,14 @@ PyEval_GetRestricted(void)
return current_frame == NULL ? 0 : current_frame->f_restricted;
}
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)
{
@ -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;