Skip to content

Commit 870f818

Browse files
committed
use bool to replace len()
1 parent 56035d4 commit 870f818

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/asyncio/threads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async def to_thread(func, /, *args, **kwargs):
2121
"""
2222
loop = events.get_running_loop()
2323
ctx = contextvars.copy_context()
24-
if len(ctx) == 0:
24+
if not ctx:
2525
callback = functools.partial(func, *args, **kwargs)
2626
else:
2727
callback = functools.partial(ctx.run, func, *args, **kwargs)

0 commit comments

Comments
 (0)