[Python-checkins] python/dist/src/Lib asyncore.py,1.41,1.42

akuchling at users.sourceforge.net akuchling at users.sourceforge.net
Wed Oct 22 09:48:29 EDT 2003


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv12416

Modified Files:
	asyncore.py 
Log Message:
[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.


Index: asyncore.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** asyncore.py	20 Oct 2003 14:01:49 -0000	1.41
--- asyncore.py	22 Oct 2003 13:48:27 -0000	1.42
***************
*** 202,205 ****
--- 202,210 ----
  
      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)
***************
*** 233,237 ****
          #self.log_info('adding channel %s' % self)
          if map is None:
!             map = socket_map
          map[self._fileno] = self
  
--- 238,242 ----
          #self.log_info('adding channel %s' % self)
          if map is None:
!             map = self._map
          map[self._fileno] = self
  
***************
*** 239,243 ****
          fd = self._fileno
          if map is None:
!             map = socket_map
          if map.has_key(fd):
              #self.log_info('closing channel %d:%s' % (fd, self))
--- 244,248 ----
          fd = self._fileno
          if map is None:
!             map = self._map
          if map.has_key(fd):
              #self.log_info('closing channel %d:%s' % (fd, self))





More information about the Python-checkins mailing list