def _setup_non_block_io(self, io): outfd = io.fileno() file_flags = fcntl.fcntl(outfd, fcntl.F_GETFL) fcntl.fcntl(outfd, fcntl.F_SETFL, file_flags | os.O_NDELAY)