From 1db9e7bb19909ed56821b1580cbb024faccac041 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 29 Jul 2014 22:32:47 +0200 Subject: Issue #22054: Add os.get_blocking() and os.set_blocking() functions to get and set the blocking mode of a file descriptor (False if the O_NONBLOCK flag is set, True otherwise). These functions are not available on Windows. --- Lib/asyncore.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'Lib/asyncore.py') diff --git a/Lib/asyncore.py b/Lib/asyncore.py index 90854b22bb..da24b3843b 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -590,8 +590,6 @@ def close_all(map=None, ignore_all=False): # Regardless, this is useful for pipes, and stdin/stdout... if os.name == 'posix': - import fcntl - class file_wrapper: # Here we override just enough to make a file # look like a socket for the purposes of asyncore. @@ -642,9 +640,7 @@ if os.name == 'posix': pass self.set_file(fd) # set it to non-blocking mode - flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) - flags = flags | os.O_NONBLOCK - fcntl.fcntl(fd, fcntl.F_SETFL, flags) + os.set_blocking(fd, False) def set_file(self, fd): self.socket = file_wrapper(fd) -- cgit v1.2.1