Support older Python 3 versions that do not have os.setblocking

This commit is contained in:
Manuel Amador (Rudd-O) 2016-09-05 03:06:19 +00:00
parent c38ed365ed
commit e73c37d96e

View File

@ -172,7 +172,10 @@ class Signaler(MyThread):
def unblock(fobj):
os.set_blocking(fobj.fileno(), False)
if hasattr(os, "set_blocking"):
return os.set_blocking(fobj.fileno(), False)
fl = fcntl.fcntl(fobj, fcntl.F_GETFL)
fcntl.fcntl(fobj, fcntl.F_SETFL, fl | os.O_NONBLOCK)
def write(dst, buffer, l):