]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-124746: remove assertion on exits having line numbers (#124762)
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>
Mon, 30 Sep 2024 00:53:47 +0000 (01:53 +0100)
committerGitHub <noreply@github.com>
Mon, 30 Sep 2024 00:53:47 +0000 (17:53 -0700)
gh-124746: remove assertion in 3.13

Python/flowgraph.c

index b8d3f066d18540839c34e67e5c034f0168ad65ac..d12b602e7100945e87ffc091a65c847021962d9c 100644 (file)
@@ -518,21 +518,6 @@ no_redundant_jumps(cfg_builder *g) {
     return true;
 }
 
-static bool
-all_exits_have_lineno(basicblock *entryblock) {
-    for (basicblock *b = entryblock; b != NULL; b = b->b_next) {
-        for (int i = 0; i < b->b_iused; i++) {
-            cfg_instr *instr = &b->b_instr[i];
-            if (instr->i_opcode == RETURN_VALUE) {
-                if (instr->i_loc.lineno < 0) {
-                    assert(0);
-                    return false;
-                }
-            }
-        }
-    }
-    return true;
-}
 #endif
 
 /***** CFG preprocessing (jump targets and exceptions) *****/
@@ -2500,7 +2485,6 @@ _PyCfg_OptimizeCodeUnit(cfg_builder *g, PyObject *consts, PyObject *const_cache,
     RETURN_IF_ERROR(insert_superinstructions(g));
 
     RETURN_IF_ERROR(push_cold_blocks_to_end(g));
-    assert(all_exits_have_lineno(g->g_entryblock));
     RETURN_IF_ERROR(resolve_line_numbers(g, firstlineno));
     return SUCCESS;
 }