Skip to content

Commit e4ba71f

Browse files
authored
GH-106008: Fix refleak when peepholing None comparisons (#106367)
1 parent c9ce983 commit e4ba71f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix possible reference leaks when failing to optimize comparisons with
2+
:const:`None` in the bytecode compiler.

Python/flowgraph.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1377,9 +1377,9 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts)
13771377
goto error;
13781378
}
13791379
if (!Py_IsNone(cnt)) {
1380+
Py_DECREF(cnt);
13801381
break;
13811382
}
1382-
Py_DECREF(cnt);
13831383
if (bb->b_iused <= i + 2) {
13841384
break;
13851385
}

0 commit comments

Comments
 (0)