def make_async(fd): """ Add the O_NONBLOCK flag to a file descriptor. """ fcntl.fcntl(fd, fcntl.F_SETFL, fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK)