summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2025-01-08 17:00:11 (GMT)
committerGitHub <noreply@github.com>2025-01-08 17:00:11 (GMT)
commit004f9fd1f22643100aa8163cc9f7bcde7df54973 (patch)
tree828cb0fb51e7aec6b85da79130ae3af8d505c140 /Python
parent845d924efb2a144120421260e62b9c4c9726fc69 (diff)
downloadcpython-004f9fd1f22643100aa8163cc9f7bcde7df54973.zip
cpython-004f9fd1f22643100aa8163cc9f7bcde7df54973.tar.gz
cpython-004f9fd1f22643100aa8163cc9f7bcde7df54973.tar.bz2
Remove unnecessary LIST_TO_TUPLE conversions (GH-126558)
Diffstat (limited to 'Python')
-rw-r--r--Python/flowgraph.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/flowgraph.c b/Python/flowgraph.c
index 017216a..24561c1 100644
--- a/Python/flowgraph.c
+++ b/Python/flowgraph.c
@@ -4,6 +4,7 @@
#include "Python.h"
#include "pycore_flowgraph.h"
#include "pycore_compile.h"
+#include "pycore_intrinsics.h"
#include "pycore_pymem.h" // _PyMem_IsPtrFreed()
#include "pycore_opcode_utils.h"
@@ -1874,6 +1875,12 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts)
continue;
}
break;
+ case CALL_INTRINSIC_1:
+ // for _ in (*foo, *bar) -> for _ in [*foo, *bar]
+ if (oparg == INTRINSIC_LIST_TO_TUPLE && nextop == GET_ITER) {
+ INSTR_SET_OP0(inst, NOP);
+ }
+ break;
}
}