[Zodb-checkins] SVN: ZODB/trunk/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:19:16 EDT 2007


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

Changed:
  U   ZODB/trunk/src/ZODB/POSException.py

-=-
Modified: ZODB/trunk/src/ZODB/POSException.py
===================================================================
--- ZODB/trunk/src/ZODB/POSException.py	2007-06-25 15:19:07 UTC (rev 77055)
+++ ZODB/trunk/src/ZODB/POSException.py	2007-06-25 15:19:15 UTC (rev 77056)
@@ -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