Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3212337

Browse files
committed
unfortunately we can't kill compiler_new_tmpname here
1 parent a1713bd commit 3212337

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Python/compile.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,16 @@ compiler_exit_scope(struct compiler *c)
551551

552552
}
553553

554+
/* Allocate a new "anonymous" local variable. Used by with statements. */
555+
556+
static PyObject *
557+
compiler_new_tmpname(struct compiler *c)
558+
{
559+
char tmpname[256];
560+
PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++c->u->u_tmpname);
561+
return PyUnicode_FromString(tmpname);
562+
}
563+
554564
/* Allocate a new block and return a pointer to it.
555565
Returns NULL on error.
556566
*/

0 commit comments

Comments
 (0)