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

tismer at codespeak.net tismer at codespeak.net
Fri Jun 17 01:44:40 CEST 2005


Author: tismer
Date: Fri Jun 17 01:44:39 2005
New Revision: 13501

Modified:
   pypy/dist/pypy/translator/translator.py
Log:
aspecial __setstate__ to get things slightly more ordered.
Actually it didn't have a real effect.

But one really big effect was that it told me how genpickle
really should work! See next check-in

Modified: pypy/dist/pypy/translator/translator.py
==============================================================================
--- pypy/dist/pypy/translator/translator.py	(original)
+++ pypy/dist/pypy/translator/translator.py	Fri Jun 17 01:44:39 2005
@@ -39,6 +39,15 @@
         if self.entrypoint:
             self.getflowgraph()
 
+    def __getstate__(self):
+        # try to produce things a bit more ordered
+        return self.entrypoint, self.functions, self.__dict__
+
+    def __setstate__(self, args):
+        assert len(args) == 3
+        self.__dict__.update(args[2])
+        assert args[0] is self.entrypoint and args[1] is self.functions
+
     def getflowgraph(self, func=None, called_by=None, call_tag=None):
         """Get the flow graph for a function (default: the entry point)."""
         func = func or self.entrypoint
@@ -139,7 +148,7 @@
     def source(self, func=None):
         """Returns original Python source.
         
-        Returns <interactive> for functions written while the
+        Returns <interactive> for functions written during the
         interactive session.
         """
         func = func or self.entrypoint



More information about the Pypy-commit mailing list