Fixed minor compatibility issue with 2.6 relating to the weird _GLOBAL_DEFAULT_TIMEOUT value.
This commit is contained in:
@@ -152,6 +152,12 @@ def set_nonblocking(fd):
|
|||||||
setblocking(0)
|
setblocking(0)
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
from socket import _GLOBAL_DEFAULT_TIMEOUT
|
||||||
|
except ImportError:
|
||||||
|
_GLOBAL_DEFAULT_TIMEOUT = object()
|
||||||
|
|
||||||
|
|
||||||
class GreenSocket(object):
|
class GreenSocket(object):
|
||||||
timeout = None
|
timeout = None
|
||||||
def __init__(self, family_or_realsock=socket.AF_INET, *args, **kwargs):
|
def __init__(self, family_or_realsock=socket.AF_INET, *args, **kwargs):
|
||||||
@@ -337,7 +343,7 @@ class GreenSocket(object):
|
|||||||
return fn(*args, **kw)
|
return fn(*args, **kw)
|
||||||
|
|
||||||
def settimeout(self, howlong):
|
def settimeout(self, howlong):
|
||||||
if howlong is None:
|
if howlong is None or howlong == _GLOBAL_DEFAULT_TIMEOUT:
|
||||||
self.setblocking(True)
|
self.setblocking(True)
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
Reference in New Issue
Block a user