Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix a crash and possible code object corruption following a
:exc:`MemoryError` while compiling Python code.
11 changes: 3 additions & 8 deletions Python/assemble.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,17 @@ assemble_init(struct assembler *a, int firstlineno)
a->a_lineno = firstlineno;
a->a_bytecode_writer = PyBytesWriter_Create(DEFAULT_CODE_SIZE);
if (a->a_bytecode_writer == NULL) {
goto error;
return ERROR;
}
a->a_linetable_writer = PyBytesWriter_Create(DEFAULT_CNOTAB_SIZE);
if (a->a_linetable_writer == NULL) {
goto error;
return ERROR;
}
a->a_except_table_writer = PyBytesWriter_Create(DEFAULT_LNOTAB_SIZE);
if (a->a_except_table_writer == NULL) {
goto error;
return ERROR;
}
return SUCCESS;
error:
PyBytesWriter_Discard(a->a_bytecode_writer);
PyBytesWriter_Discard(a->a_linetable_writer);
PyBytesWriter_Discard(a->a_except_table_writer);
return ERROR;
}

static void
Expand Down
Loading