[pypy-svn] r13071 - pypy/dist/pypy/translator

tismer at codespeak.net tismer at codespeak.net
Sun Jun 5 04:12:40 CEST 2005


Author: tismer
Date: Sun Jun  5 04:12:39 2005
New Revision: 13071

Modified:
   pypy/dist/pypy/translator/annrpython.py
Log:
added explicit support for pickling.
corrected ordering of code in __init__ according to comments.

Modified: pypy/dist/pypy/translator/annrpython.py
==============================================================================
--- pypy/dist/pypy/translator/annrpython.py	(original)
+++ pypy/dist/pypy/translator/annrpython.py	Sun Jun  5 04:12:39 2005
@@ -39,11 +39,21 @@
                 # bindingshistory
         self.reflowcounter = {}
         self.return_bindings = {} # map return Variables to functions
-        # user-supplied annotation logic for functions we don't want to flow into
-        self.overrides = overrides
         # --- end of debugging information ---
         self.bookkeeper = Bookkeeper(self)
+        # user-supplied annotation logic for functions we don't want to flow into
+        self.overrides = overrides
 
+    def __getstate__(self):
+        attrs = """translator pendingblocks bindings annotated links_followed
+        notify bookkeeper overrides""".split()
+        ret = self.__dict__.copy()
+        for key, value in ret.items():
+            if key not in attrs:
+                assert type(value) is dict, ("please update %s.__getstate__" %
+                                             self.__class__.__name__)
+                ret[key] = {}
+        return ret
 
     def _register_returnvar(self, flowgraph, func):
         if annmodel.DEBUG:



More information about the Pypy-commit mailing list