Skip to content

Commit ea112a5

Browse files
committed
Address code review
1 parent c901079 commit ea112a5

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,19 +2367,20 @@ def testfunc(n):
23672367
def test_store_fast_pop_top_specialize_unicode(self):
23682368
def random_str(n):
23692369
return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(n))
2370-
def testfunc(n):
2371-
y = random_str(32)
2370+
def testfunc(args):
2371+
a, b, n = args
2372+
c = ''
23722373
for _ in range(n):
2373-
x = y + y # _POP_TOP
2374-
x = None # _POP_TOP_NOP
2375-
2376-
testfunc(TIER2_THRESHOLD)
2374+
c += a + b
2375+
return c
23772376

2378-
ex = get_first_executor(testfunc)
2377+
r0, r1 = random_str(32), random_str(32)
2378+
res, ex = self._run_with_optimizer(testfunc, (r0, r1, TIER2_THRESHOLD))
2379+
self.assertAlmostEqual(res, TIER2_THRESHOLD * (r0 + r1))
23792380
self.assertIsNotNone(ex)
23802381
uops = get_opnames(ex)
2381-
23822382
self.assertIn("_POP_TOP_NOP", uops)
2383+
self.assertNotIn("_POP_TOP_UNICODE", uops)
23832384

23842385
def test_attr_promotion_failure(self):
23852386
# We're not testing for any specific uops here, just

0 commit comments

Comments
 (0)