Commit ffe637b2 authored by Denis Bilenko's avatar Denis Bilenko

monkey: warn if threading is already imported

parent 97f05b3f
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
import sys import sys
noisy = True
def patch_os(): def patch_os():
from gevent.hub import fork from gevent.hub import fork
import os import os
...@@ -13,6 +15,8 @@ def patch_time(): ...@@ -13,6 +15,8 @@ def patch_time():
_time.sleep = sleep _time.sleep = sleep
def patch_thread(): 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 from gevent import thread as green_thread
thread = __import__('thread') thread = __import__('thread')
thread.get_ident = green_thread.get_ident thread.get_ident = green_thread.get_ident
......
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