Merge pull request #2 from MeilleursAgents/fix_thread_module_import
Fix `thread` module import on Python 2.7
This commit is contained in:
commit
92ae05553b
|
@ -6,7 +6,10 @@ not need to be rewritten for when the thread module is not present.
|
|||
Suggested usage is::
|
||||
|
||||
try:
|
||||
import _thread
|
||||
try:
|
||||
import _thread # Python >= 3
|
||||
except:
|
||||
import thread as _thread # Python < 3
|
||||
except ImportError:
|
||||
import _dummy_thread as _thread
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ from .reprlib32 import recursive_repr as _recursive_repr
|
|||
from weakref import proxy as _proxy
|
||||
import sys as _sys
|
||||
try:
|
||||
from _thread import allocate_lock as Lock
|
||||
except:
|
||||
from thread import allocate_lock as Lock
|
||||
except ImportError:
|
||||
from ._dummy_thread32 import allocate_lock as Lock
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -5,7 +5,7 @@ __all__ = ["Repr", "repr", "recursive_repr"]
|
|||
import __builtin__ as builtins
|
||||
from itertools import islice
|
||||
try:
|
||||
from _thread import get_ident
|
||||
from thread import get_ident
|
||||
except ImportError:
|
||||
from _dummy_thread32 import get_ident
|
||||
|
||||
|
|
Loading…
Reference in New Issue