Skip to content

Commit c401539

Browse files
committed
fix review idea
Signed-off-by: Manjusaka <me@manjusaka.me>
1 parent cf17d92 commit c401539

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,30 +1926,30 @@ def testfunc(n):
19261926
self.assertNotIn("_GUARD_TOS_INT", uops)
19271927

19281928
def test_get_len(self):
1929-
def testfunc1(n):
1930-
x = 0
1929+
def testfunc(n):
1930+
x = ""
19311931
for _ in range(n):
19321932
match (1, 2, 3, 4):
19331933
case [_, _, _, _]:
1934-
x += 1
1934+
x += "1"
19351935
return x
1936-
res, ex = self._run_with_optimizer(testfunc1, TIER2_THRESHOLD)
1937-
self.assertEqual(res, TIER2_THRESHOLD)
1936+
res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
1937+
self.assertEqual(len(res), TIER2_THRESHOLD)
19381938
uops = get_opnames(ex)
1939-
self.assertNotIn("_GUARD_TOS_INT", uops)
1939+
self.assertNotIn("_GUARD_NOS_INT", uops)
19401940
self.assertIn("_GET_LEN", uops)
19411941
self.assertIn("_POP_TOP_LOAD_CONST_INLINE_BORROW", uops)
1942-
def testfunc1(n):
1943-
x = 0
1942+
def testfunc(n):
1943+
x = ""
19441944
for _ in range(n):
19451945
match [1, 2, 3, 4]:
19461946
case [_, _, _, _]:
1947-
x += 1
1947+
x += "1"
19481948
return x
1949-
res, ex = self._run_with_optimizer(testfunc1, TIER2_THRESHOLD)
1950-
self.assertEqual(res, TIER2_THRESHOLD)
1949+
res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
1950+
self.assertEqual(len(res), TIER2_THRESHOLD)
19511951
uops = get_opnames(ex)
1952-
self.assertNotIn("_GUARD_TOS_INT", uops)
1952+
self.assertNotIn("_GUARD_NOS_INT", uops)
19531953
self.assertIn("_GET_LEN", uops)
19541954
self.assertNotIn("_POP_TOP_LOAD_CONST_INLINE_BORROW", uops)
19551955

Python/optimizer_bytecodes.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "pycore_uops.h"
44
#include "pycore_uop_ids.h"
55
#include "internal/pycore_moduleobject.h"
6-
#include "tupleobject.h"
76

87
#define op(name, ...) /* NAME is ignored */
98

0 commit comments

Comments
 (0)