Skip to content

Commit 3ebcb0a

Browse files
committed
address reivew
1 parent 42ac68e commit 3ebcb0a

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
@@ -1473,12 +1473,12 @@ fold_constant_intrinsic_list_to_tuple(basicblock *bb, int i,
14731473
assert(PyList_CheckExact(consts));
14741474
assert(i >= 0);
14751475
assert(i < bb->b_iused);
1476+
14761477
cfg_instr *intrinsic = &bb->b_instr[i];
14771478
assert(intrinsic->i_opcode == CALL_INTRINSIC_1);
14781479
assert(intrinsic->i_oparg == INTRINSIC_LIST_TO_TUPLE);
14791480

14801481
int consts_found = 0;
1481-
bool start_found = false;
14821482
bool expect_append = true;
14831483

14841484
for (int pos = i - 1; pos >= 0; pos--) {
@@ -1491,29 +1491,31 @@ fold_constant_intrinsic_list_to_tuple(basicblock *bb, int i,
14911491
}
14921492

14931493
if (opcode == BUILD_LIST && oparg == 0) {
1494-
start_found = expect_append;
1495-
break;
1494+
if (!expect_append) {
1495+
return SUCCESS;
1496+
}
1497+
goto start_found;
14961498
}
14971499

14981500
if (expect_append) {
14991501
if (opcode != LIST_APPEND || oparg != 1) {
1500-
break;
1502+
return SUCCESS;
15011503
}
15021504
}
15031505
else {
15041506
if (!loads_const(opcode)) {
1505-
break;
1507+
return SUCCESS;
15061508
}
15071509
consts_found++;
15081510
}
15091511

15101512
expect_append = !expect_append;
15111513
}
15121514

1513-
if (!start_found) {
1514-
return SUCCESS;
1515-
}
1515+
/* Did not find sequence start. */
1516+
return SUCCESS;
15161517

1518+
start_found:;
15171519
PyObject *newconst = PyTuple_New((Py_ssize_t)consts_found);
15181520
if (newconst == NULL) {
15191521
return ERROR;

0 commit comments

Comments
 (0)