Skip to content

Commit e3b94d8

Browse files
[3.15] gh-151112: Move an assert that may fail in cfg_builder_check (GH-151153) (#151313)
(cherry picked from commit 2d33810) Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent a8ddc9a commit e3b94d8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Python/flowgraph.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ cfg_builder_maybe_start_new_block(cfg_builder *g)
403403
static bool
404404
cfg_builder_check(cfg_builder *g)
405405
{
406-
assert(g->g_entryblock->b_iused > 0);
407406
for (basicblock *block = g->g_block_list; block != NULL; block = block->b_list) {
408407
assert(!_PyMem_IsPtrFreed(block));
409408
if (block->b_instr != NULL) {
@@ -3756,6 +3755,7 @@ _PyCfg_OptimizeCodeUnit(cfg_builder *g, PyObject *consts, PyObject *const_cache,
37563755
int nlocals, int nparams, int firstlineno)
37573756
{
37583757
assert(cfg_builder_check(g));
3758+
assert(g->g_entryblock->b_iused > 0);
37593759
/** Preprocessing **/
37603760
/* Map labels to targets and mark exception handlers */
37613761
RETURN_IF_ERROR(translate_jump_labels_to_targets(g->g_entryblock));

0 commit comments

Comments
 (0)