Update PyNode_CompileSymtable() to understand future statements

This commit is contained in:
Jeremy Hylton 2001-03-21 19:01:33 +00:00
parent 823649d544
commit ded4bd776f

View file

@ -3780,23 +3780,29 @@ struct symtable *
PyNode_CompileSymtable(node *n, char *filename) PyNode_CompileSymtable(node *n, char *filename)
{ {
struct symtable *st; struct symtable *st;
PyFutureFeatures *ff;
ff = PyNode_Future(n, filename);
if (ff == NULL)
return NULL;
st = symtable_init(); st = symtable_init();
if (st == NULL) if (st == NULL)
return NULL; return NULL;
assert(st->st_symbols != NULL); st->st_future = ff;
symtable_enter_scope(st, TOP, TYPE(n), n->n_lineno); symtable_enter_scope(st, TOP, TYPE(n), n->n_lineno);
if (st->st_errors > 0) { if (st->st_errors > 0)
PySymtable_Free(st); goto fail;
return NULL;
}
symtable_node(st, n); symtable_node(st, n);
if (st->st_errors > 0) { if (st->st_errors > 0)
goto fail;
return st;
fail:
PyMem_Free((void *)ff);
st->st_future = NULL;
PySymtable_Free(st); PySymtable_Free(st);
return NULL; return NULL;
} }
return st;
}
static PyCodeObject * static PyCodeObject *
icompile(node *n, struct compiling *base) icompile(node *n, struct compiling *base)