diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-03-10 15:11:47 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-10 15:11:47 -0800 |
commit | 5506d603021518eaaa89e7037905f7a698c5e95c (patch) | |
tree | 85eb2a8668a8a09fe3a604401f1b845a931d067f /Python/symtable.c | |
parent | bpo-27645: Add support for native backup facility of SQLite (GH-4238) (diff) | |
download | cpython-5506d603021518eaaa89e7037905f7a698c5e95c.tar.gz cpython-5506d603021518eaaa89e7037905f7a698c5e95c.tar.bz2 cpython-5506d603021518eaaa89e7037905f7a698c5e95c.zip |
bpo-32836: Remove obsolete code from symtable pass (GH-5680)
When comprehensions switched to using a nested scope, the old
code for generating a temporary name to hold the accumulation
target became redundant, but was never actually removed.
Patch by Nitish Chandra.
(cherry picked from commit 3a087beddd9f0955eb9080a6fd1499ff89ca74bf)
Co-authored-by: Nitish Chandra <nitishchandrachinta@gmail.com>
Diffstat (limited to 'Python/symtable.c')
-rw-r--r-- | Python/symtable.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/Python/symtable.c b/Python/symtable.c index bbac25cf376..1c328a99614 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -69,7 +69,6 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block, ste->ste_varkeywords = 0; ste->ste_opt_lineno = 0; ste->ste_opt_col_offset = 0; - ste->ste_tmpname = 0; ste->ste_lineno = lineno; ste->ste_col_offset = col_offset; @@ -1083,24 +1082,6 @@ error: } static int -symtable_new_tmpname(struct symtable *st) -{ - char tmpname[256]; - identifier tmp; - - PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", - ++st->st_cur->ste_tmpname); - tmp = PyUnicode_InternFromString(tmpname); - if (!tmp) - return 0; - if (!symtable_add_def(st, tmp, DEF_LOCAL)) - return 0; - Py_DECREF(tmp); - return 1; -} - - -static int symtable_record_directive(struct symtable *st, identifier name, stmt_ty s) { PyObject *data, *mangled; @@ -1723,7 +1704,6 @@ symtable_handle_comprehension(struct symtable *st, expr_ty e, expr_ty elt, expr_ty value) { int is_generator = (e->kind == GeneratorExp_kind); - int needs_tmp = !is_generator; comprehension_ty outermost = ((comprehension_ty) asdl_seq_GET(generators, 0)); /* Outermost iterator is evaluated in current scope */ @@ -1742,11 +1722,6 @@ symtable_handle_comprehension(struct symtable *st, expr_ty e, symtable_exit_block(st, (void *)e); return 0; } - /* Allocate temporary name if needed */ - if (needs_tmp && !symtable_new_tmpname(st)) { - symtable_exit_block(st, (void *)e); - return 0; - } VISIT(st, expr, outermost->target); VISIT_SEQ(st, expr, outermost->ifs); VISIT_SEQ_TAIL(st, comprehension, generators, 1); |