Skip to content

Commit 59e46ce

Browse files
committed
Fix DeprecationWarning regarding throw() on pytests
Signed-off-by: Ziheng Deng <zihengd@nvidia.com>
1 parent cae38a1 commit 59e46ce

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/cuda/tile/_coroutine_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def run_coroutine(awaitable: Awaitable):
2020
while stack:
2121
top = stack[-1]
2222
try:
23-
continuation = top.send(ret) if exc_info is None else top.throw(*exc_info)
23+
continuation = top.send(ret) if exc_info is None else top.throw(exc_info[1])
2424
except StopIteration as s:
2525
ret = s.value
2626
exc_info = None

src/cuda/tile/_stub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ def reduce(x, /, axis, func, identity, *, keepdims=False):
13411341
being combined, while the rest correspond to the other.
13421342
identity: a constant scalar or a tuple of constant scalars that specifies the identity
13431343
element of the `func`.
1344-
keepdims (bool): True to remove the reduced axis, False to keep the axis of size 1.
1344+
keepdims (bool): True to keep the axis of size 1, False to remove the reduced axis.
13451345
Default: False.
13461346
13471347
Returns:

test/test_coroutine_util.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from cuda.tile._coroutine_util import resume_after, run_coroutine
66
import pytest
7+
import traceback
78

89

910
async def series(n):
@@ -60,3 +61,19 @@ async def two_calls():
6061
def test_return_values():
6162
res = run_coroutine(two_calls())
6263
assert res == (1 + 2 + 3, 1 + 2 + 3 + 4)
64+
65+
66+
async def raise_in_leaf():
67+
raise ValueError("leaf")
68+
69+
70+
async def call_leaf():
71+
await resume_after(raise_in_leaf())
72+
73+
74+
def test_traceback_preserved():
75+
try:
76+
run_coroutine(call_leaf())
77+
except ValueError as e:
78+
frame_names = [f.name for f in traceback.extract_tb(e.__traceback__)]
79+
assert "raise_in_leaf" in frame_names

0 commit comments

Comments
 (0)