Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ded4bd7

Browse files
committed
Update PyNode_CompileSymtable() to understand future statements
1 parent 823649d commit ded4bd7

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

Python/compile.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3780,22 +3780,28 @@ struct symtable *
37803780
PyNode_CompileSymtable(node *n, char *filename)
37813781
{
37823782
struct symtable *st;
3783+
PyFutureFeatures *ff;
37833784

3785+
ff = PyNode_Future(n, filename);
3786+
if (ff == NULL)
3787+
return NULL;
37843788
st = symtable_init();
37853789
if (st == NULL)
37863790
return NULL;
3787-
assert(st->st_symbols != NULL);
3791+
st->st_future = ff;
37883792
symtable_enter_scope(st, TOP, TYPE(n), n->n_lineno);
3789-
if (st->st_errors > 0) {
3790-
PySymtable_Free(st);
3791-
return NULL;
3792-
}
3793+
if (st->st_errors > 0)
3794+
goto fail;
37933795
symtable_node(st, n);
3794-
if (st->st_errors > 0) {
3795-
PySymtable_Free(st);
3796-
return NULL;
3797-
}
3796+
if (st->st_errors > 0)
3797+
goto fail;
3798+
37983799
return st;
3800+
fail:
3801+
PyMem_Free((void *)ff);
3802+
st->st_future = NULL;
3803+
PySymtable_Free(st);
3804+
return NULL;
37993805
}
38003806

38013807
static PyCodeObject *

0 commit comments

Comments
 (0)