DL_IMPORT(PyObject *) PyEval_GetOwner(void);
DL_IMPORT(PyObject *) PyEval_GetFrame(void);
DL_IMPORT(int) PyEval_GetRestricted(void);
+DL_IMPORT(int) PyEval_GetNestedScopes(void);
DL_IMPORT(int) Py_FlushLine(void);
#define CO_NEWLOCALS 0x0002
#define CO_VARARGS 0x0004
#define CO_VARKEYWORDS 0x0008
+#define CO_NESTED 0x0010
extern DL_IMPORT(PyTypeObject) PyCode_Type;
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)
{
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;
symtable_update_flags(struct compiling *c, PySymtableEntryObject *ste,
struct symbol_info *si)
{
+ if (c->c_future && c->c_future->ff_nested_scopes)
+ c->c_flags |= CO_NESTED;
if (ste->ste_type != TYPE_MODULE)
c->c_flags |= CO_NEWLOCALS;
if (ste->ste_type == TYPE_FUNCTION) {