]> granicus.if.org Git - python/commitdiff
unfortunately we can't kill compiler_new_tmpname here
authorBenjamin Peterson <benjamin@python.org>
Sun, 28 Jun 2009 22:36:18 +0000 (22:36 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sun, 28 Jun 2009 22:36:18 +0000 (22:36 +0000)
Python/compile.c

index 11d7c3317d5728948f88405c501078af9c95d8d8..23722b2e5ee865e9645e4e44c33124e74412376a 100644 (file)
@@ -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.
 */