summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-11-21 14:37:37 +0100
committerVictor Stinner <victor.stinner@gmail.com>2014-11-21 14:37:37 +0100
commit9426e8154b7e9a4477cfa804f8219edaf68ddad3 (patch)
tree21ce5d6b7d73a45cc279fe00b5b981ab3f24f600
parent503357f418217d072a0ab3457ac6a21971440622 (diff)
downloadaioeventlet-9426e8154b7e9a4477cfa804f8219edaf68ddad3.tar.gz
Fix monkey-unpatching of BaseDefaultEventLoopPolicy
-rw-r--r--aiogreen.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/aiogreen.py b/aiogreen.py
index f2ee377..88bdab3 100644
--- a/aiogreen.py
+++ b/aiogreen.py
@@ -32,6 +32,14 @@ if eventlet.patcher.is_monkey_patched('socket'):
asyncio.unix_events.threading = threading
# FIXME: patch also trollius.py3_ssl
+ # BaseDefaultEventLoopPolicy._Local must inherit from threading.local
+ # of the original threading module, not the patched threading module
+ class _Local(threading.local):
+ _loop = None
+ _set_called = False
+
+ asyncio.events.BaseDefaultEventLoopPolicy._Local = _Local
+
_EVENT_READ = asyncio.selectors.EVENT_READ
_EVENT_WRITE = asyncio.selectors.EVENT_WRITE
_HUB_READ = eventlet.hubs.hub.READ