gh-115796: fix exception table construction in _testinternalcapi.assemble_code_object (#115797)

This commit is contained in:
Irit Katriel 2024-02-22 12:36:44 +00:00 committed by GitHub
parent 8aa372edcd
commit 96c1737591
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 52 additions and 8 deletions

View file

@ -665,12 +665,6 @@ translate_jump_labels_to_targets(basicblock *entryblock)
return SUCCESS;
}
int
_PyCfg_JumpLabelsToTargets(cfg_builder *g)
{
return translate_jump_labels_to_targets(g->g_entryblock);
}
static int
mark_except_handlers(basicblock *entryblock) {
#ifndef NDEBUG
@ -2790,3 +2784,14 @@ _PyCfg_OptimizedCfgToInstructionSequence(cfg_builder *g,
return SUCCESS;
}
/* This is used by _PyCompile_Assemble to fill in the jump and exception
* targets in a synthetic CFG (which is not the ouptut of the builtin compiler).
*/
int
_PyCfg_JumpLabelsToTargets(cfg_builder *g)
{
RETURN_IF_ERROR(translate_jump_labels_to_targets(g->g_entryblock));
RETURN_IF_ERROR(label_exception_targets(g->g_entryblock));
return SUCCESS;
}