Commit d87970a8 authored by Denis Bilenko's avatar Denis Bilenko

Fixed issue #63: monkey.patch_thread() now patches threading too, even if it’s...

Fixed issue #63: monkey.patch_thread() now patches threading too, even if it’s already imported. Patch by Shaun Lindsay. (pulled from gevent-0.13)
parent 9322b5f5
......@@ -58,8 +58,6 @@ Monkey patches:
import sys
noisy = True
__all__ = ['patch_all',
'patch_socket',
'patch_ssl',
......@@ -119,10 +117,13 @@ def patch_thread(threading=True, _threading_local=True):
return
from gevent.local import local
if threading:
if noisy and 'threading' in sys.modules:
sys.stderr.write("gevent.monkey's warning: 'threading' is already imported\n\n")
from gevent import thread as green_thread
threading = __import__('threading')
threading.local = local
threading._start_new_thread = green_thread.start_new_thread
threading._allocate_lock = green_thread.allocate_lock
threading.Lock = green_thread.allocate_lock
threading._get_ident = green_thread.get_ident
if _threading_local:
_threading_local = __import__('_threading_local')
_threading_local.local = local
......
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