[Zodb-checkins] SVN: ZODB/branches/3.4/src/ZEO/zrpc/connection.py Port from 2.7 branch.

Tim Peters tim.one at comcast.net
Tue Oct 4 13:34:53 EDT 2005


Log message for revision 38747:
  Port from 2.7 branch.
  
  Collector 1900.
  
  send_reply(), return_error():  Stop trying to catch an exception that doesn't
  exist, when marshal.encode() raises an exception.  Jeremy simplified the
  marshal.encode() half of this about 3 years ago, but apparently forgot to
  change ZEO/zrpc/connection.py to match.
  

Changed:
  U   ZODB/branches/3.4/src/ZEO/zrpc/connection.py

-=-
Modified: ZODB/branches/3.4/src/ZEO/zrpc/connection.py
===================================================================
--- ZODB/branches/3.4/src/ZEO/zrpc/connection.py	2005-10-04 16:45:01 UTC (rev 38746)
+++ ZODB/branches/3.4/src/ZEO/zrpc/connection.py	2005-10-04 17:34:52 UTC (rev 38747)
@@ -460,9 +460,13 @@
         return hasattr(self.obj, name)
 
     def send_reply(self, msgid, ret):
+        # encode() can pass on a wide variety of exceptions from cPickle.
+        # While a bare `except` is generally poor practice, in this case
+        # it's acceptable -- we really do want to catch every exception
+        # cPickle may raise.
         try:
             msg = self.marshal.encode(msgid, 0, REPLY, ret)
-        except self.marshal.errors:
+        except: # see above
             try:
                 r = short_repr(ret)
             except:
@@ -480,9 +484,13 @@
         if type(err_value) is not types.InstanceType:
             err_value = err_type, err_value
 
+        # encode() can pass on a wide variety of exceptions from cPickle.
+        # While a bare `except` is generally poor practice, in this case
+        # it's acceptable -- we really do want to catch every exception
+        # cPickle may raise.
         try:
             msg = self.marshal.encode(msgid, 0, REPLY, (err_type, err_value))
-        except self.marshal.errors:
+        except: # see above
             try:
                 r = short_repr(err_value)
             except:



More information about the Zodb-checkins mailing list