Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 81fecf7

Browse filesBrowse files
bpo-37289: Remove 'if False' handling in the peephole optimizer (GH-14099) (GH-14111)
(cherry picked from commit 7a68f8c) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
1 parent d799fd3 commit 81fecf7
Copy full SHA for 81fecf7

File tree

Expand file treeCollapse file tree

1 file changed

+3
-9
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-9
lines changed

‎Python/peephole.c

Copy file name to clipboardExpand all lines: Python/peephole.c
+3-9Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -309,18 +309,12 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
309309
}
310310
PyObject* cnt = PyList_GET_ITEM(consts, get_arg(codestr, i));
311311
int is_true = PyObject_IsTrue(cnt);
312+
if (is_true == -1) {
313+
goto exitError;
314+
}
312315
if (is_true == 1) {
313316
fill_nops(codestr, op_start, nexti + 1);
314317
cumlc = 0;
315-
} else if (is_true == 0) {
316-
if (i > 1 &&
317-
(_Py_OPCODE(codestr[i - 1]) == POP_JUMP_IF_TRUE ||
318-
_Py_OPCODE(codestr[i - 1]) == POP_JUMP_IF_FALSE)) {
319-
break;
320-
}
321-
h = get_arg(codestr, nexti) / sizeof(_Py_CODEUNIT);
322-
tgt = find_op(codestr, codelen, h);
323-
fill_nops(codestr, op_start, tgt);
324318
}
325319
break;
326320

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.