Commit 2fe0d7e7 authored by Tim Peters's avatar Tim Peters

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.
parent d37154f6
......@@ -460,9 +460,13 @@ class Connection(smac.SizedMessageAsyncConnection, object):
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 @@ class Connection(smac.SizedMessageAsyncConnection, object):
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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment