Skip to content

Commit ff75e2d

Browse files
committed
Disable test on free-threaded builds
1 parent 16ddae6 commit ff75e2d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

mypyc/test-data/run-async.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,6 +1424,8 @@ import weakref
14241424
from functools import wraps
14251425
from typing import Any, Callable, TypeVar, cast
14261426

1427+
from testutil import is_gil_disabled
1428+
14271429
def identity(val: int) -> int:
14281430
return val
14291431

@@ -1591,12 +1593,18 @@ def test_nested() -> None:
15911593
assert asyncio.run(nested_wrapped_async()) == 4
15921594

15931595
def test_async_function_wrapper_code_refcount() -> None:
1596+
if is_gil_disabled():
1597+
# On free-threaded builds the code object might be immortal, so the ref count test doesn't work.
1598+
return
15941599
code = getattr(identity_async, "__code__")
15951600
getrefcount = getattr(sys, "getrefcount")
15961601
# getrefcount sees the local code variable plus the wrapper-owned reference.
15971602
assert getrefcount(code) == 2, getrefcount(code)
15981603

15991604
def test_nested_async_function_wrapper_code_refcount() -> None:
1605+
if is_gil_disabled():
1606+
# On free-threaded builds the code object might be immortal, so the ref count test doesn't work.
1607+
return
16001608
def make_nested() -> Any:
16011609
async def nested_refcounted() -> int:
16021610
return 1

0 commit comments

Comments
 (0)