Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 17124:a8301d4ed2b1 legacy-trunk
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.
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Thu, 22 Mar 2001 02:32:48 +0000 |
| parents | 6fe13d008e25 |
| children | 2054cea38754 |
line wrap: on
line diff
--- a/Python/ceval.c Thu Mar 22 00:40:23 2001 +0000 +++ b/Python/ceval.c Thu Mar 22 02:32:48 2001 +0000 @@ -2667,6 +2667,14 @@ } 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 @@ 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;
