Commit 504f334c authored by Vincent Michel's avatar Vincent Michel
Browse files

Fix gevent patch

parent d040c8d5
...@@ -10,7 +10,7 @@ from __future__ import absolute_import ...@@ -10,7 +10,7 @@ from __future__ import absolute_import
from functools import wraps from functools import wraps
from gevent import threadpool from gevent import threadpool
from .interface import handel from . import interface
# Green pool # Green pool
...@@ -41,7 +41,12 @@ def patch(): ...@@ -41,7 +41,12 @@ def patch():
>>> from handel.gevent import patch >>> from handel.gevent import patch
>>> patch() >>> patch()
""" """
for name in dir(handel): # Gevent-compatible version of handel FFI library
gevent_handel = type('GeventFFILibrary', (), {})()
# Populate gevent_handel
for name in dir(interface.handel):
if name.startswith('xia'): if name.startswith('xia'):
func = getattr(handel, name) func = getattr(interface.handel, name)
setattr(handel, name, green(func)) setattr(gevent_handel, name, green(func))
# Patch
interface.handel = gevent_handel
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment