summaryrefslogtreecommitdiff
path: root/Lib/asyncore.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2003-10-22 13:48:27 +0000
committerAndrew M. Kuchling <amk@amk.ca>2003-10-22 13:48:27 +0000
commitf9ca40929241fa83c4fc7a8f2ba6c334286e5e16 (patch)
tree08a0e1f1a23105b2ac73de6bf81c06de8223f8a5 /Lib/asyncore.py
parentd22bb6584d61b822bd1d6841a40f50d31aba650c (diff)
downloadcpython-git-f9ca40929241fa83c4fc7a8f2ba6c334286e5e16.tar.gz
[Bug #758241] When you use asyncore with a non-default map, methods
of the dispatcher object break. e.g. if you close() the object, it tries to remove itself from the default map, not from the map the dispatcher was created with. The patch, from Stephane Ninin, records the map as an attribute of the dispatcher instance. 2.3 bugfix candidate.
Diffstat (limited to 'Lib/asyncore.py')
-rw-r--r--Lib/asyncore.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
index 7fb84b47fa..7bd269b744 100644
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -201,6 +201,11 @@ class dispatcher:
addr = None
def __init__(self, sock=None, map=None):
+ if map is None:
+ self._map = socket_map
+ else:
+ self._map = map
+
if sock:
self.set_socket(sock, map)
# I think it should inherit this anyway
@@ -232,13 +237,13 @@ class dispatcher:
def add_channel(self, map=None):
#self.log_info('adding channel %s' % self)
if map is None:
- map = socket_map
+ map = self._map
map[self._fileno] = self
def del_channel(self, map=None):
fd = self._fileno
if map is None:
- map = socket_map
+ map = self._map
if map.has_key(fd):
#self.log_info('closing channel %d:%s' % (fd, self))
del map[fd]