Skip to content

Commit 6f27ec1

Browse files
author
Paul Sokolovsky
committed
asyncio_micro: Work around stupid Python closures.
Which don't close variables, just variable references.
1 parent a728368 commit 6f27ec1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

asyncio_micro/asyncio_micro.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ def run_forever(self):
6969
elif isinstance(ret, IORead):
7070
# self.add_reader(ret.obj.fileno(), lambda self, c, f: self.call_soon(c, f), self, cb, ret.obj)
7171
# self.add_reader(ret.obj.fileno(), lambda c, f: self.call_soon(c, f), cb, ret.obj)
72-
self.add_reader(ret.obj.fileno(), lambda f: self.call_soon(cb, f), ret.obj)
72+
self.add_reader(ret.obj.fileno(), lambda cb, f: self.call_soon(cb, f), cb, ret.obj)
7373
continue
7474
elif isinstance(ret, IOWrite):
75-
self.add_writer(ret.obj.fileno(), lambda f: self.call_soon(cb, f), ret.obj)
75+
self.add_writer(ret.obj.fileno(), lambda cb, f: self.call_soon(cb, f), cb, ret.obj)
7676
continue
7777
elif isinstance(ret, IODone):
7878
if ret.op == IO_READ:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy