gh-94332: make it safe to call assemble_free when assemble_init has not been called (GH-94389)

This commit is contained in:
Irit Katriel 2022-06-30 12:26:29 +01:00 committed by GitHub
parent 21cbdae90f
commit be82d26570
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8554,6 +8554,8 @@ assemble(struct compiler *c, int addNone)
{
PyCodeObject *co = NULL;
PyObject *consts = NULL;
struct assembler a;
memset(&a, 0, sizeof(struct assembler));
int code_flags = compute_code_flags(c);
if (code_flags < 0) {
@ -8683,7 +8685,6 @@ assemble(struct compiler *c, int addNone)
/* Create assembler */
struct assembler a;
if (!assemble_init(&a, c->u->u_firstlineno))
goto error;