[Zodb-checkins] SVN: ZODB/branches/3.5/src/ZEO/zrpc/connection.py Merge rev 38747 from 3.4 branch.

Tim Peters tim.one at comcast.net
Tue Oct 4 13:37:41 EDT 2005


Log message for revision 38748:
  Merge rev 38747 from 3.4 branch.
  
  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.5/src/ZEO/zrpc/connection.py

-=-
Modified: ZODB/branches/3.5/src/ZEO/zrpc/connection.py
===================================================================
--- ZODB/branches/3.5/src/ZEO/zrpc/connection.py	2005-10-04 17:34:52 UTC (rev 38747)
+++ ZODB/branches/3.5/src/ZEO/zrpc/connection.py	2005-10-04 17:37:40 UTC (rev 38748)
@@ -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