Commit 1f02e4a9 authored by Fantix King's avatar Fantix King

Handle renaming of "thread" to "_thread" in PY3

parent d48e4d86
...@@ -22,6 +22,7 @@ if sys.version_info[0] <= 2: ...@@ -22,6 +22,7 @@ if sys.version_info[0] <= 2:
import thread as __thread__ import thread as __thread__
else: else:
import _thread as __thread__ import _thread as __thread__
__target__ = '_thread'
error = __thread__.error error = __thread__.error
from gevent.hub import getcurrent, GreenletExit from gevent.hub import getcurrent, GreenletExit
from gevent.greenlet import Greenlet from gevent.greenlet import Greenlet
......
...@@ -2,7 +2,10 @@ from __future__ import with_statement ...@@ -2,7 +2,10 @@ from __future__ import with_statement
import gevent import gevent
import gevent.core import gevent.core
import time import time
import thread try:
import thread
except ImportError:
import _thread as thread
hub = gevent.get_hub() hub = gevent.get_hub()
......
...@@ -4,7 +4,10 @@ monkey.patch_all() ...@@ -4,7 +4,10 @@ monkey.patch_all()
import time import time
assert 'built-in' not in repr(time.sleep), repr(time.sleep) assert 'built-in' not in repr(time.sleep), repr(time.sleep)
import thread try:
import thread
except ImportError:
import _thread as thread
import threading import threading
assert 'built-in' not in repr(thread.start_new_thread), repr(thread.start_new_thread) assert 'built-in' not in repr(thread.start_new_thread), repr(thread.start_new_thread)
assert 'built-in' not in repr(threading._start_new_thread), repr(threading._start_new_thread) assert 'built-in' not in repr(threading._start_new_thread), repr(threading._start_new_thread)
......
...@@ -37,7 +37,10 @@ import random ...@@ -37,7 +37,10 @@ import random
import re import re
import sys import sys
import threading import threading
import thread try:
import thread
except ImportError:
import _thread as thread
import time import time
import unittest import unittest
import weakref import weakref
......
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