@@ -1299,16 +1299,16 @@ def try_making_globals(
12991299 rb"[\w_.]+\." + word , word , new_tc .parts [chunk_start ]
13001300 )
13011301 maybe_removed += len (new_tc .parts [chunk_start ]) - len (subst )
1302- new_tc .parts = (
1303- new_tc .parts [:chunk_start ]
1304- + [ subst ]
1305- + new_tc .parts [( chunk_start + 1 ) :]
1306- )
1307- new_tc .reducible = (
1308- new_tc .reducible [:chunk_start ]
1309- + [ True ]
1310- + new_tc .reducible [( chunk_start + 1 ) :]
1311- )
1302+ new_tc .parts = [
1303+ * new_tc .parts [:chunk_start ],
1304+ subst ,
1305+ * new_tc .parts [chunk_start + 1 :],
1306+ ]
1307+ new_tc .reducible = [
1308+ * new_tc .reducible [:chunk_start ],
1309+ True ,
1310+ * new_tc .reducible [chunk_start + 1 :],
1311+ ]
13121312
13131313 for test in iterator .try_testcase (
13141314 new_tc , "Removing prefixes of " + description
@@ -1480,14 +1480,16 @@ def try_arguments_as_globals(
14801480 arg_defs = args_map ["defs" ]
14811481 def_chunk = args_map ["chunk" ]
14821482 subst = new_tc .parts [def_chunk ].replace (args_map ["args_pattern" ], b"" , 1 )
1483- new_tc .parts = (
1484- new_tc .parts [:def_chunk ] + [subst ] + new_tc .parts [(def_chunk + 1 ) :]
1485- )
1486- new_tc .reducible = (
1487- new_tc .reducible [:def_chunk ]
1488- + [True ]
1489- + new_tc .reducible [(def_chunk + 1 ) :]
1490- )
1483+ new_tc .parts = [
1484+ * new_tc .parts [:def_chunk ],
1485+ subst ,
1486+ * new_tc .parts [def_chunk + 1 :],
1487+ ]
1488+ new_tc .reducible = [
1489+ * new_tc .reducible [:def_chunk ],
1490+ True ,
1491+ * new_tc .reducible [def_chunk + 1 :],
1492+ ]
14911493
14921494 # Copy callers arguments to globals.
14931495 for arg_use in args_map ["uses" ]:
@@ -1501,12 +1503,16 @@ def try_arguments_as_globals(
15011503 (a + b" = " + v + b";\n " ) for (a , v ) in zip (arg_defs , values )
15021504 )
15031505 subst = setters + new_tc .parts [chunk ]
1504- new_tc .parts = (
1505- new_tc .parts [:chunk ] + [subst ] + new_tc .parts [(chunk + 1 ) :]
1506- )
1507- new_tc .reducible = (
1508- new_tc .reducible [:chunk ] + [True ] + new_tc .reducible [(chunk + 1 ) :]
1509- )
1506+ new_tc .parts = [
1507+ * new_tc .parts [:chunk ],
1508+ subst ,
1509+ * new_tc .parts [chunk + 1 :],
1510+ ]
1511+ new_tc .reducible = [
1512+ * new_tc .reducible [:chunk ],
1513+ True ,
1514+ * new_tc .reducible [chunk + 1 :],
1515+ ]
15101516 maybe_moved_arguments += len (arg_defs )
15111517
15121518 for test in iterator .try_testcase (new_tc , "Removing " + description ):
@@ -1527,12 +1533,16 @@ def try_arguments_as_globals(
15271533 subst = new_tc .parts [chunk ].replace (arg_use ["pattern" ], fun + b"()" , 1 )
15281534 if new_tc .parts [chunk ] == subst :
15291535 continue
1530- new_tc .parts = (
1531- new_tc .parts [:chunk ] + [subst ] + new_tc .parts [(chunk + 1 ) :]
1532- )
1533- new_tc .reducible = (
1534- new_tc .reducible [:chunk ] + [True ] + new_tc .reducible [(chunk + 1 ) :]
1535- )
1536+ new_tc .parts = [
1537+ * new_tc .parts [:chunk ],
1538+ subst ,
1539+ * new_tc .parts [chunk + 1 :],
1540+ ]
1541+ new_tc .reducible = [
1542+ * new_tc .reducible [:chunk ],
1543+ True ,
1544+ * new_tc .reducible [chunk + 1 :],
1545+ ]
15361546 maybe_moved_arguments = len (values )
15371547
15381548 for test in iterator .try_testcase (
@@ -1564,14 +1574,16 @@ def try_arguments_as_globals(
15641574 subst = new_tc .parts [def_chunk ].replace (b"," .join (arg_defs ), b"" , 1 )
15651575 if new_tc .parts [def_chunk ] == subst :
15661576 noop_changes += 1
1567- new_tc .parts = (
1568- new_tc .parts [:def_chunk ] + [subst ] + new_tc .parts [(def_chunk + 1 ) :]
1569- )
1570- new_tc .reducible = (
1571- new_tc .reducible [:def_chunk ]
1572- + [True ]
1573- + new_tc .reducible [(def_chunk + 1 ) :]
1574- )
1577+ new_tc .parts = [
1578+ * new_tc .parts [:def_chunk ],
1579+ subst ,
1580+ * new_tc .parts [def_chunk + 1 :],
1581+ ]
1582+ new_tc .reducible = [
1583+ * new_tc .reducible [:def_chunk ],
1584+ True ,
1585+ * new_tc .reducible [def_chunk + 1 :],
1586+ ]
15751587
15761588 # Replace arguments by their value in the scope of the function.
15771589 while len (values ) < len (arg_defs ):
@@ -1582,23 +1594,27 @@ def try_arguments_as_globals(
15821594 subst = new_tc .parts [def_chunk ] + b"\n " + setters
15831595 if new_tc .parts [def_chunk ] == subst :
15841596 noop_changes += 1
1585- new_tc .parts = (
1586- new_tc .parts [:def_chunk ] + [subst ] + new_tc .parts [(def_chunk + 1 ) :]
1587- )
1588- new_tc .reducible = (
1589- new_tc .reducible [:def_chunk ]
1590- + [True ]
1591- + new_tc .reducible [(def_chunk + 1 ) :]
1592- )
1597+ new_tc .parts = [
1598+ * new_tc .parts [:def_chunk ],
1599+ subst ,
1600+ * new_tc .parts [def_chunk + 1 :],
1601+ ]
1602+ new_tc .reducible = [
1603+ * new_tc .reducible [:def_chunk ],
1604+ True ,
1605+ * new_tc .reducible [def_chunk + 1 :],
1606+ ]
15931607
15941608 # Remove arguments of the anonymous function call.
15951609 subst = new_tc .parts [chunk ].replace (b"," .join (anon ["use" ]), b"" , 1 )
15961610 if new_tc .parts [chunk ] == subst :
15971611 noop_changes += 1
1598- new_tc .parts = new_tc .parts [:chunk ] + [subst ] + new_tc .parts [(chunk + 1 ) :]
1599- new_tc .reducible = (
1600- new_tc .reducible [:chunk ] + [True ] + new_tc .reducible [(chunk + 1 ) :]
1601- )
1612+ new_tc .parts = [* new_tc .parts [:chunk ], subst , * new_tc .parts [chunk + 1 :]]
1613+ new_tc .reducible = [
1614+ * new_tc .reducible [:chunk ],
1615+ True ,
1616+ * new_tc .reducible [chunk + 1 :],
1617+ ]
16021618 maybe_moved_arguments += len (values )
16031619
16041620 if noop_changes == 3 :
0 commit comments