diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-06-28 22:36:18 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-06-28 22:36:18 (GMT) |
commit | 32123370f4051896a378df8d64b09adf81bd967a (patch) | |
tree | 56804695dd27a6c21e477eff14a4395d994b529e /Python | |
parent | a1713bdfed6f634aa054b74b99e50180157698ae (diff) | |
download | cpython-32123370f4051896a378df8d64b09adf81bd967a.zip cpython-32123370f4051896a378df8d64b09adf81bd967a.tar.gz cpython-32123370f4051896a378df8d64b09adf81bd967a.tar.bz2 |
unfortunately we can't kill compiler_new_tmpname here
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c index 11d7c33..23722b2 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. */ |