mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Update PyNode_CompileSymtable() to understand future statements
This commit is contained in:
parent
823649d544
commit
ded4bd776f
1 changed files with 15 additions and 9 deletions
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue