Skip to content

Commit

Permalink
upgrade pyre version in fbcode/later - batch 1
Browse files Browse the repository at this point in the history
Differential Revision: D53014065

fbshipit-source-id: 4e193e10b1bd3d14124a8185e34e9a6ed3052706
  • Loading branch information
generatedunixname89002005307016 authored and facebook-github-bot committed Jan 24, 2024
1 parent 9414619 commit 4247cd6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions later/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ async def cancel(fut: asyncio.Future) -> None:
if ex is not None:
raise ex from None
# fut finished instead of cancelled, wat?
# pyre-fixme[48]: Expression `asyncio.InvalidStateError("task didn't raise
# CancelledError on cancel: "f"{fut}"" had result "f"{fut.result()}")` has type
# `InvalidStateError` but must extend BaseException.
# pyre-fixme[19]: Expected 0 positional arguments.
raise asyncio.InvalidStateError(
f"task didn't raise CancelledError on cancel: {fut} had result {fut.result()}"
)
Expand Down
3 changes: 3 additions & 0 deletions later/tests/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ async def _coro() -> int | None:
task: asyncio.Task = _coro()
await asyncio.sleep(0)
self.assertTrue(started)
# pyre-fixme[6]: For 1st argument expected `Union[Type[Variable[_E (bound to
# BaseException)]], typing.Tuple[Type[Variable[_E (bound to BaseException)]],
# ...]]` but got `Type[InvalidStateError]`.
with self.assertRaises(asyncio.InvalidStateError):
await later.cancel(task)
self.assertTrue(task.done())
Expand Down

0 comments on commit 4247cd6

Please sign in to comment.