Skip to content

Commit 3d95ee3

Browse files
code review
1 parent d4fa65c commit 3d95ee3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Lib/asyncio/events.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class TimerHandle(Handle):
102102

103103
def __init__(self, when, callback, args, loop, context=None):
104104
if when is None:
105-
raise ValueError('when cannot be None')
105+
raise ValueError("when cannot be None")
106106
super().__init__(callback, args, loop, context)
107107
if self._source_traceback:
108108
del self._source_traceback[-1]
@@ -663,7 +663,7 @@ def set_event_loop(self, loop):
663663
"""Set the event loop."""
664664
self._local._set_called = True
665665
if loop is not None and not isinstance(loop, AbstractEventLoop):
666-
raise TypeError(f'loop must be an instance of AbstractEventLoop or None, not {type(loop)}')
666+
raise TypeError(f"loop must be an instance of AbstractEventLoop or None, not '{type(loop).__name__}'")
667667
self._local._loop = loop
668668

669669
def new_event_loop(self):
@@ -748,7 +748,7 @@ def set_event_loop_policy(policy):
748748
If policy is None, the default policy is restored."""
749749
global _event_loop_policy
750750
if policy is not None and not isinstance(policy, AbstractEventLoopPolicy):
751-
raise TypeError(f'policy must be an instance of AbstractEventLoopPolicy or None, not {type(policy)}')
751+
raise TypeError(f"policy must be an instance of AbstractEventLoopPolicy or None, not '{type(policy).__name__}'")
752752
_event_loop_policy = policy
753753

754754

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Replaced asserts with exceptions in asyncio, patch by Kumar Aditya.

0 commit comments

Comments
 (0)