diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-03-21 19:01:33 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-03-21 19:01:33 (GMT) |
commit | ded4bd776f25d892e5dbdc642f3b92aacd43dae1 (patch) | |
tree | 691d2db680bbeac9d49713909c3ab8155c5a1c8a | |
parent | 823649d544eec66a61176dbb76b51a9408c7f4ed (diff) | |
download | cpython-ded4bd776f25d892e5dbdc642f3b92aacd43dae1.zip cpython-ded4bd776f25d892e5dbdc642f3b92aacd43dae1.tar.gz cpython-ded4bd776f25d892e5dbdc642f3b92aacd43dae1.tar.bz2 |
Update PyNode_CompileSymtable() to understand future statements
-rw-r--r-- | Python/compile.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/Python/compile.c b/Python/compile.c index ed50f7e..cd936a3 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3780,22 +3780,28 @@ struct symtable * PyNode_CompileSymtable(node *n, char *filename) { struct symtable *st; + PyFutureFeatures *ff; + ff = PyNode_Future(n, filename); + if (ff == NULL) + return NULL; st = symtable_init(); if (st == NULL) return NULL; - assert(st->st_symbols != NULL); + st->st_future = ff; symtable_enter_scope(st, TOP, TYPE(n), n->n_lineno); - if (st->st_errors > 0) { - PySymtable_Free(st); - return NULL; - } + if (st->st_errors > 0) + goto fail; symtable_node(st, n); - if (st->st_errors > 0) { - PySymtable_Free(st); - return NULL; - } + if (st->st_errors > 0) + goto fail; + return st; + fail: + PyMem_Free((void *)ff); + st->st_future = NULL; + PySymtable_Free(st); + return NULL; } static PyCodeObject * |