Skip to content

Commit ff6cf4e

Browse files
committed
Fix future.backports.misc.create_connection() on Py26
1 parent d7d6e01 commit ff6cf4e

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/future/backports/misc.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import heapq as _heapq
2222
from _weakref import proxy as _proxy
2323
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
24-
24+
from socket import getaddrinfo, SOCK_STREAM, error, socket
2525

2626
from future.utils import iteritems, itervalues, PY26, PY3
2727

@@ -39,10 +39,18 @@ def ceil(x):
3939
########################################################################
4040

4141
from itertools import islice
42-
try:
43-
from _thread import get_ident
44-
except ImportError:
45-
from _dummy_thread import get_ident
42+
43+
if PY3:
44+
try:
45+
from _thread import get_ident
46+
except ImportError:
47+
from _dummy_thread import get_ident
48+
else:
49+
try:
50+
from thread import get_ident
51+
except ImportError:
52+
from dummy_thread import get_ident
53+
4654

4755
def recursive_repr(fillvalue='...'):
4856
'Decorator to make a repr function return fillvalue for a recursive call'

0 commit comments

Comments
 (0)