Skip to content

Commit be82d26

Browse files
authored
pythongh-94332: make it safe to call assemble_free when assemble_init has not been called (pythonGH-94389)
1 parent 21cbdae commit be82d26

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Python/compile.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8554,6 +8554,8 @@ assemble(struct compiler *c, int addNone)
85548554
{
85558555
PyCodeObject *co = NULL;
85568556
PyObject *consts = NULL;
8557+
struct assembler a;
8558+
memset(&a, 0, sizeof(struct assembler));
85578559

85588560
int code_flags = compute_code_flags(c);
85598561
if (code_flags < 0) {
@@ -8683,7 +8685,6 @@ assemble(struct compiler *c, int addNone)
86838685

86848686

86858687
/* Create assembler */
8686-
struct assembler a;
86878688
if (!assemble_init(&a, c->u->u_firstlineno))
86888689
goto error;
86898690

0 commit comments

Comments
 (0)