Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/asyncio/timeouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def __repr__(self) -> str:
async def __aenter__(self) -> "Timeout":
self._state = _State.ENTERED
self._task = tasks.current_task()
self._cancelling = self._task.cancelling()
if self._task is None:
raise RuntimeError("Timeout should be used inside a task")
self._cancelling = self._task.cancelling()
self.reschedule(self._when)
return self

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix :class:`asyncio.Timeout` raising an :exc:`AttributeError` over a :exc:`RuntimeError` due to logic bug. Patch by James Hilton-Balfe
Comment thread
Eclips4 marked this conversation as resolved.