Skip to content

Commit 9930bc1

Browse files
committed
Fix skipped test
1 parent 43b99a6 commit 9930bc1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

extmod/moduasyncio.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,13 @@ STATIC mp_obj_t task_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) {
294294
STATIC mp_obj_t task_iternext(mp_obj_t self_in) {
295295
mp_obj_task_t *self = MP_OBJ_TO_PTR(self_in);
296296
if (TASK_IS_DONE(self)) {
297-
// Task finished, raise return value to caller so it can continue.
298-
nlr_raise(self->data);
297+
if (self->data == mp_const_none) {
298+
// Task finished but has already been sent to the loop's exception handler.
299+
mp_raise_StopIteration(MP_OBJ_NULL);
300+
} else {
301+
// Task finished, raise return value to caller so it can continue.
302+
nlr_raise(self->data);
303+
}
299304
} else {
300305
// Put calling task on waiting queue.
301306
mp_obj_t cur_task = mp_obj_dict_get(uasyncio_context, MP_OBJ_NEW_QSTR(MP_QSTR_cur_task));

tests/extmod/uasyncio_task_exception.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
# If the task _is_ subsequently awaited, then the await should succeed without
88
# raising.
99

10-
# TODO: Fix this test.
11-
print("SKIP")
12-
raise SystemExit
13-
1410
try:
1511
import asyncio
1612
except ImportError:
@@ -38,7 +34,6 @@ async def task():
3834
await asyncio.sleep(0)
3935
print("await")
4036
await t # should not raise.
41-
print("await done")
4237

4338

4439
asyncio.run(main())

0 commit comments

Comments
 (0)