8000 (#61) First step towards AppEngine support: Make select optional. · github3py/urllib3@3177886 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3177886

Browse files
committed
(urllib3#61) First step towards AppEngine support: Make select optional.
1 parent 2d95e4b commit 3177886

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

urllib3/util.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99

1010
try:
1111
from select import poll, POLLIN
12-
except ImportError: # Doesn't exist on OSX and other platforms
13-
from select import select
12+
except ImportError: # `poll` doesn't exist on OSX and other platforms
1413
poll = False
14+
try:
15+
from select import select
16+
except ImportError: # `select` doesn't exist on AppEngine.
17+
select = False
1518

1619
from .packages import six
17-
1820
from .exceptions import LocationParseError
1921

2022

@@ -114,6 +116,11 @@ def is_connection_dropped(conn):
114116
``HTTPConnection`` object.
115117
"""
116118
if not poll: # Platform-specific
119+
if not select: #Platform-specific
120+
# For environments like AppEngine which handle its own socket reuse, we
121+
# can assume they will be recycled transparently to us.
122+
return False
123+
117124
return select([conn.sock], [], [], 0.0)[0]
118125

119126
# This version is better on platforms that support it.

0 commit comments

Comments
 (0)
0