Fix test_capi.test_misc when run with -R:: (#107566)

Should fix the buildbot failures.

This creates a new function each time that test is run, like Victor did for other tests.
This commit is contained in:
Guido van Rossum 2023-08-02 12:05:25 -07:00 committed by GitHub
parent 0d30a5a409
commit af8141cf87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 30 deletions

View File

@ -2464,6 +2464,8 @@ def testfunc(x):
def test_extended_arg(self):
"Check EXTENDED_ARG handling in superblock creation"
ns = {}
exec(textwrap.dedent("""
def many_vars():
# 260 vars, so z9 should have index 259
a0 = a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 42
@ -2494,6 +2496,8 @@ def many_vars():
z0 = z1 = z2 = z3 = z4 = z5 = z6 = z7 = z8 = z9 = 42
while z9 > 0:
z9 = z9 - 1
"""), ns, ns)
many_vars = ns["many_vars"]
opt = _testinternalcapi.get_uop_optimizer()
with temporary_optimizer(opt):