Commit 0ebd48e3 authored by Denis Bilenko's avatar Denis Bilenko

monkey: avoid spurious warnings

parent a58a8202
......@@ -15,10 +15,9 @@ def patch_time():
_time.sleep = sleep
def patch_thread():
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
thread = __import__('thread')
if thread.exit is not green_thread.exit:
thread.get_ident = green_thread.get_ident
thread.start_new_thread = green_thread.start_new_thread
thread.LockType = green_thread.LockType
......@@ -26,6 +25,8 @@ def patch_thread():
thread.exit = green_thread.exit
if hasattr(green_thread, 'stack_size'):
thread.stack_size = green_thread.stack_size
if noisy and 'threading' in sys.modules:
sys.stderr.write("gevent.monkey's warning: 'threading' is already imported\n\n")
# built-in thread._local object won't work as greenlet-local
if '_threading_local' not in sys.modules:
import _threading_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