Skip to content

Commit e3d0e3b

Browse files
committed
Apply last reviews
1 parent 1dbceab commit e3d0e3b

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Lib/asyncio/tasks.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,9 @@ def __step(self, exc=None):
268268
raise exceptions.InvalidStateError(
269269
f'__step(): already done: {self!r}, {exc!r}')
270270
if self._must_cancel:
271-
# gh-108549: do not swallow SystemExit and KeyboardInterrupt
271+
# gh-108549: do not swallow SystemExit and KeyboardInterrupt.
272272
if not isinstance(exc, (exceptions.CancelledError,
273-
SystemExit, KeyboardInterrupt)
274-
):
273+
SystemExit, KeyboardInterrupt)):
275274
exc = self._make_cancelled_error()
276275
self._must_cancel = False
277276
self._fut_waiter = None

Lib/test/test_asyncio/test_tasks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,6 +1904,7 @@ async def current_task(exc):
19041904
pass
19051905
except BaseException as e:
19061906
self.fail(f'{exc} is expected, instead of {type(e)}')
1907+
return "ok"
19071908

19081909
for exc in (SystemExit, KeyboardInterrupt):
19091910
with self.subTest(exc):
@@ -1912,6 +1913,7 @@ async def current_task(exc):
19121913
t.cancel()
19131914
test_utils.run_briefly(self.loop)
19141915
self.assertTrue(not t.cancelled())
1916+
self.assertEqual(t.result(), "ok")
19151917

19161918
def test_step_result_future(self):
19171919
# If coroutine returns future, task waits on this future.

0 commit comments

Comments
 (0)