From: Benjamin Peterson <benjamin@python.org> Date: Sun, 28 Jun 2009 22:36:18 +0000 (+0000) Subject: unfortunately we can't kill compiler_new_tmpname here X-Git-Tag: v3.1.1rc1~126 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32123370f4051896a378df8d64b09adf81bd967a;p=python unfortunately we can't kill compiler_new_tmpname here --- diff --git a/Python/compile.c b/Python/compile.c index 11d7c3317d..23722b2e5e 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -551,6 +551,16 @@ compiler_exit_scope(struct compiler *c) } +/* Allocate a new "anonymous" local variable. Used by with statements. */ + +static PyObject * +compiler_new_tmpname(struct compiler *c) +{ + char tmpname[256]; + PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++c->u->u_tmpname); + return PyUnicode_FromString(tmpname); +} + /* Allocate a new block and return a pointer to it. Returns NULL on error. */