Skip to content

Commit 0e0fffc

Browse files
committed
uasyncio.core: Optimize case of resuming coro with no args.
Don't create a new tuple with empty arguments for coro.send(), just use next(coro).
1 parent 37f8273 commit 0e0fffc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

uasyncio.core/uasyncio/core.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ def run_forever(self):
6464
else:
6565
delay = 0
6666
try:
67-
if args == ():
68-
args = (None,)
6967
if __debug__:
7068
log.debug("Coroutine %s send args: %s", cb, args)
71-
ret = cb.send(*args)
69+
if args == ():
70+
ret = next(cb)
71+
else:
72+
ret = cb.send(*args)
7273
if __debug__:
7374
log.debug("Coroutine %s yield result: %s", cb, ret)
7475
if isinstance(ret, SysCall1):

0 commit comments

Comments
 (0)