summaryrefslogtreecommitdiff
path: root/Lib/asyncore.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-29 22:32:47 +0200
committerVictor Stinner <victor.stinner@gmail.com>2014-07-29 22:32:47 +0200
commit1db9e7bb19909ed56821b1580cbb024faccac041 (patch)
tree20043197ec08844340c9ac039fe26c630bd4189d /Lib/asyncore.py
parent6aa4269ed25f7fdddd99fe1d7b09b8406ecb05ea (diff)
downloadcpython-git-1db9e7bb19909ed56821b1580cbb024faccac041.tar.gz
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.
Diffstat (limited to 'Lib/asyncore.py')
-rw-r--r--Lib/asyncore.py6
1 files changed, 1 insertions, 5 deletions
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)