Skip to content

Commit bffc456

Browse files
committed
address reivew
1 parent 4ae59f8 commit bffc456

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

Python/flowgraph.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,12 +1503,12 @@ fold_constant_intrinsic_list_to_tuple(basicblock *bb, int i,
15031503
assert(PyList_CheckExact(consts));
15041504
assert(i >= 0);
15051505
assert(i < bb->b_iused);
1506+
15061507
cfg_instr *intrinsic = &bb->b_instr[i];
15071508
assert(intrinsic->i_opcode == CALL_INTRINSIC_1);
15081509
assert(intrinsic->i_oparg == INTRINSIC_LIST_TO_TUPLE);
15091510

15101511
int consts_found = 0;
1511-
bool start_found = false;
15121512
bool expect_append = true;
15131513

15141514
for (int pos = i - 1; pos >= 0; pos--) {
@@ -1521,29 +1521,31 @@ fold_constant_intrinsic_list_to_tuple(basicblock *bb, int i,
15211521
}
15221522

15231523
if (opcode == BUILD_LIST && oparg == 0) {
1524-
start_found = expect_append;
1525-
break;
1524+
if (!expect_append) {
1525+
return SUCCESS;
1526+
}
1527+
goto start_found;
15261528
}
15271529

15281530
if (expect_append) {
15291531
if (opcode != LIST_APPEND || oparg != 1) {
1530-
break;
1532+
return SUCCESS;
15311533
}
15321534
}
15331535
else {
15341536
if (!loads_const(opcode)) {
1535-
break;
1537+
return SUCCESS;
15361538
}
15371539
consts_found++;
15381540
}
15391541

15401542
expect_append = !expect_append;
15411543
}
15421544

1543-
if (!start_found) {
1544-
return SUCCESS;
1545-
}
1545+
/* Did not find sequence start. */
1546+
return SUCCESS;
15461547

1548+
start_found:;
15471549
PyObject *newconst = PyTuple_New((Py_ssize_t)consts_found);
15481550
if (newconst == NULL) {
15491551
return ERROR;

0 commit comments

Comments
 (0)