Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 54949:d51017dcba24 3.1
unfortunately we can't kill compiler_new_tmpname here
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sun, 28 Jun 2009 22:36:18 +0000 |
| parents | f94c09aa4444 |
| children | b97e8cebe8ed |
line wrap: on
line diff
--- a/Python/compile.c Sun Jun 28 21:25:41 2009 +0000 +++ b/Python/compile.c Sun Jun 28 22:36:18 2009 +0000 @@ -551,6 +551,16 @@ } +/* 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. */
