diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2003-10-22 14:38:27 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2003-10-22 14:38:27 (GMT) |
commit | 6c2871e707b88cede6a18e72c6c55721da9b610f (patch) | |
tree | 8db66b328daabab7a642fe235d08b7c4192a8e73 /Lib | |
parent | 38afcef3f5649a88acc83d655adf73835924e63b (diff) | |
download | cpython-6c2871e707b88cede6a18e72c6c55721da9b610f.zip cpython-6c2871e707b88cede6a18e72c6c55721da9b610f.tar.gz cpython-6c2871e707b88cede6a18e72c6c55721da9b610f.tar.bz2 |
[Part of patch #648322] Delete the poll2() function, which uses a 'poll' extension module that was once part of Medusa. Contributed by Kjetil Jacobsen
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/asyncore.py | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py index 7bd269b..fa70e19 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -125,30 +125,6 @@ def poll(timeout=0.0, map=None): write(obj) def poll2(timeout=0.0, map=None): - import poll - if map is None: - map = socket_map - if timeout is not None: - # timeout is in milliseconds - timeout = int(timeout*1000) - if map: - l = [] - for fd, obj in map.items(): - flags = 0 - if obj.readable(): - flags = poll.POLLIN - if obj.writable(): - flags = flags | poll.POLLOUT - if flags: - l.append((fd, flags)) - r = poll.poll(l, timeout) - for fd, flags in r: - obj = map.get(fd) - if obj is None: - continue - readwrite(obj, flags) - -def poll3(timeout=0.0, map=None): # Use the poll() support added to the select module in Python 2.0 if map is None: map = socket_map @@ -177,15 +153,14 @@ def poll3(timeout=0.0, map=None): continue readwrite(obj, flags) +poll3 = poll2 # Alias for backward compatibility + def loop(timeout=30.0, use_poll=0, map=None): if map is None: map = socket_map - if use_poll: - if hasattr(select, 'poll'): - poll_fun = poll3 - else: - poll_fun = poll2 + if use_poll and hasattr(select, 'poll'): + poll_fun = poll2 else: poll_fun = poll |