kopia lustrzana https://github.com/micropython/micropython-lib
uasyncio: wait: Add workaround against heap alloc on empty iteration.
"for a in ():" unconditionally allocates heap so far, per https://github.com/micropython/micropython/issues/2716 . So, test for empty result before iterating over it.pull/62/merge
rodzic
9d5919dd1c
commit
f29be360c0
|
@ -60,14 +60,17 @@ class EpollEventLoop(EventLoop):
|
||||||
else:
|
else:
|
||||||
res = self.poller.poll(delay, 1)
|
res = self.poller.poll(delay, 1)
|
||||||
#log.debug("epoll result: %s", res)
|
#log.debug("epoll result: %s", res)
|
||||||
for fd, ev in res:
|
# Remove "if res" workaround after
|
||||||
cb = self.objmap[fd]
|
# https://github.com/micropython/micropython/issues/2716 fixed.
|
||||||
if __debug__:
|
if res:
|
||||||
log.debug("Calling IO callback: %r", cb)
|
for fd, ev in res:
|
||||||
if isinstance(cb, tuple):
|
cb = self.objmap[fd]
|
||||||
cb[0](*cb[1])
|
if __debug__:
|
||||||
else:
|
log.debug("Calling IO callback: %r", cb)
|
||||||
self.call_soon(cb)
|
if isinstance(cb, tuple):
|
||||||
|
cb[0](*cb[1])
|
||||||
|
else:
|
||||||
|
self.call_soon(cb)
|
||||||
|
|
||||||
|
|
||||||
class StreamReader:
|
class StreamReader:
|
||||||
|
|
Ładowanie…
Reference in New Issue