1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-05 21:10:57 +00:00

core/loop: fix last commit

This commit is contained in:
Jan Pochyla 2019-08-22 17:36:04 +02:00
parent 2c8b90f86e
commit 7789a29d50

View File

@ -386,16 +386,20 @@ class chan:
def put(self, value: Any) -> None: def put(self, value: Any) -> None:
put = chan.Put(self, value) put = chan.Put(self, value)
try: try:
yield put return (yield put)
except: # noqa: E722 except: # noqa: E722
self.putters.remove((put.task, value)) entry = (put.task, value)
if entry in self.putters:
self.putters.remove(entry)
raise
def take(self) -> None: def take(self) -> None:
take = chan.Take(self) take = chan.Take(self)
try: try:
yield take return (yield take)
except: # noqa: E722 except: # noqa: E722
self.takers.remove(take.task) if take.task in self.takers:
self.takers.remove(take.task)
raise raise
def publish(self, value: Any) -> None: def publish(self, value: Any) -> None: