Fixed minor compatibility issue with 2.6 relating to the weird _GLOBAL_DEFAULT_TIMEOUT value.

This commit is contained in:
Ryan Williams
2009-11-28 15:41:10 -05:00
parent 4db20f2a28
commit eb359c7f85

View File

@@ -152,6 +152,12 @@ def set_nonblocking(fd):
setblocking(0)
try:
from socket import _GLOBAL_DEFAULT_TIMEOUT
except ImportError:
_GLOBAL_DEFAULT_TIMEOUT = object()
class GreenSocket(object):
timeout = None
def __init__(self, family_or_realsock=socket.AF_INET, *args, **kwargs):
@@ -337,7 +343,7 @@ class GreenSocket(object):
return fn(*args, **kw)
def settimeout(self, howlong):
if howlong is None:
if howlong is None or howlong == _GLOBAL_DEFAULT_TIMEOUT:
self.setblocking(True)
return
try: