[Zodb-checkins] SVN: ZODB/branches/3.8/src/ZODB/POSException.py Add a work-around for a bug in exception pickling in Python 2.5.

Jim Fulton jim at zope.com
Mon Jun 25 11:00:19 EDT 2007


Log message for revision 77048:
  Add a work-around for a bug in exception pickling in Python 2.5.
  

Changed:
  U   ZODB/branches/3.8/src/ZODB/POSException.py

-=-
Modified: ZODB/branches/3.8/src/ZODB/POSException.py
===================================================================
--- ZODB/branches/3.8/src/ZODB/POSException.py	2007-06-25 15:00:15 UTC (rev 77047)
+++ ZODB/branches/3.8/src/ZODB/POSException.py	2007-06-25 15:00:17 UTC (rev 77048)
@@ -21,9 +21,23 @@
     s = reason and (": %s" % reason) or ""
     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):
     """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):
     """Key not found in database."""
 



More information about the Zodb-checkins mailing list