Skip to content

Commit dce6713

Browse files
committed
try to catch bad contexts in handles
1 parent b93657b commit dce6713

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

trio_asyncio/handles.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,13 @@ async def _call_async(self, task_status=trio.TASK_STATUS_IGNORED):
130130

131131
class Handle(_TrioHandle, asyncio.Handle):
132132
def __init__(self, callback, args, loop, context=None, is_sync=True):
133+
assert not isinstance(context, bool)
133134
super().__init__(callback, args, loop, context=context)
134135
self._init(is_sync)
135136

136137
class TimerHandle(_TrioHandle, asyncio.TimerHandle):
137138
def __init__(self, when, callback, args, loop, context=None, is_sync=True):
139+
assert not isinstance(context, bool)
138140
super().__init__(when, callback, args, loop, context=context)
139141
self._init(is_sync)
140142

0 commit comments

Comments
 (0)