Commit f16c22fb authored by Jim Fulton's avatar Jim Fulton

Add a work-around for a bug in exception pickling in Python 2.5.

parent a5d2b4c8
...@@ -21,9 +21,23 @@ def _fmt_undo(oid, reason): ...@@ -21,9 +21,23 @@ def _fmt_undo(oid, reason):
s = reason and (": %s" % reason) or "" s = reason and (": %s" % reason) or ""
return "Undo error %s%s" % (oid_repr(oid), s) return "Undo error %s%s" % (oid_repr(oid), s)
def _recon(class_, state):
err = class_.__new__(class_)
err.__setstate__(state)
return err
_recon.__no_side_effects__ = True
class POSError(StandardError): class POSError(StandardError):
"""Persistent object system error.""" """Persistent object system error."""
def __reduce__(self):
# Cope extra data from internal structures
state = self.__dict__.copy()
state['message'] = self.message
state['args'] = self.args
return (_recon, (self.__class__, state))
class POSKeyError(KeyError, POSError): class POSKeyError(KeyError, POSError):
"""Key not found in database.""" """Key not found in database."""
......
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