Skip to content

Commit 92ae055

Browse files
committed
Merge pull request michilu#2 from MeilleursAgents/fix_thread_module_import
Fix `thread` module import on Python 2.7
2 parents 8158f61 + 438927e commit 92ae055

4 files changed

Lines changed: 8 additions & 5 deletions

File tree

functools32/_dummy_thread32.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
Suggested usage is::
77
88
try:
9-
import _thread
9+
try:
10+
import _thread # Python >= 3
11+
except:
12+
import thread as _thread # Python < 3
1013
except ImportError:
1114
import _dummy_thread as _thread
1215

functools32/functools32.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
from weakref import proxy as _proxy
1818
import sys as _sys
1919
try:
20-
from _thread import allocate_lock as Lock
21-
except:
20+
from thread import allocate_lock as Lock
21+
except ImportError:
2222
from ._dummy_thread32 import allocate_lock as Lock
2323

2424
################################################################################

functools32/reprlib32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import __builtin__ as builtins
66
from itertools import islice
77
try:
8-
from _thread import get_ident
8+
from thread import get_ident
99
except ImportError:
1010
from _dummy_thread32 import get_ident
1111

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def main():
1111

1212
setup(
1313
name='functools32',
14-
version='3.2.3-1',
14+
version='3.2.3-2',
1515
description='Backport of the functools module from Python 3.2.3 for use on 2.7 and PyPy.',
1616
long_description="""
1717
This is a backport of the functools standard library module from

0 commit comments

Comments
 (0)