[Zope-Checkins] CVS: Packages/ZEO/zrpc - connection.py:1.49.4.5

Tim Peters tim.one at comcast.net
Wed Feb 9 11:03:42 EST 2005


Update of /cvs-repository/Packages/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv14261/ZEO/zrpc

Modified Files:
      Tag: Zope-2_7-branch
	connection.py 
Log Message:
Connection.__init__():  Python 2.4 added a new gimmick to asyncore (a
._map attribute on asyncore.dispatcher instances) that breaks the
delicate ZEO startup dance.  Repaired that.


=== Packages/ZEO/zrpc/connection.py 1.49.4.4 => 1.49.4.5 ===
--- Packages/ZEO/zrpc/connection.py:1.49.4.4	Fri Feb  4 14:50:13 2005
+++ Packages/ZEO/zrpc/connection.py	Wed Feb  9 11:03:41 2005
@@ -265,6 +265,17 @@
         # Now it's safe to register with asyncore's socket map; it was not
         # safe before message_input was replaced, or before handshake() was
         # invoked.
+        # Obscure:  in Python 2.4, the base asyncore.dispatcher class grew
+        # a ._map attribute, which is used instead of asyncore's global
+        # socket map when ._map isn't None.  Because we passed `ourmap` to
+        # the base class constructor above, in 2.4 asyncore believes we want
+        # to use `ourmap` instead of the global socket map -- but we don't.
+        # So we have to replace our ._map with the global socket map, and
+        # update the global socket map with `ourmap`.  Replacing our ._map
+        # isn't necessary before Python 2.4, but doesn't hurt then (it just
+        # gives us an unused attribute in 2.3); updating the global socket
+        # map is necessary regardless of Python version.
+        self._map = asyncore.socket_map
         asyncore.socket_map.update(ourmap)
 
     def __repr__(self):



More information about the Zope-Checkins mailing list