[pypy-svn] r13568 - pypy/dist/pypy/annotation

tismer at codespeak.net tismer at codespeak.net
Sat Jun 18 00:41:49 CEST 2005


Author: tismer
Date: Sat Jun 18 00:41:48 2005
New Revision: 13568

Modified:
   pypy/dist/pypy/annotation/bookkeeper.py
Log:
changed immutable_cache to use Constant()
insteadof id(). This supports pickling.

Modified: pypy/dist/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/dist/pypy/annotation/bookkeeper.py	(original)
+++ pypy/dist/pypy/annotation/bookkeeper.py	Sat Jun 18 00:41:48 2005
@@ -274,20 +274,22 @@
             result = SomeFloat()
         elif tp is list:
             try:
-                return self.immutable_cache[id(x)]
+                key = Constant(x)
+                return self.immutable_cache[key]
             except KeyError:
                 result = SomeList(ListDef(self, SomeImpossibleValue()))
-                self.immutable_cache[id(x)] = result
+                self.immutable_cache[key] = result
                 for e in x:
                     result.listdef.generalize(self.immutablevalue(e))
         elif tp is dict:   # exactly a dict
             try:
-                return self.immutable_cache[id(x)]
+                key = Constant(x)
+                return self.immutable_cache[key]
             except KeyError:
                 result = SomeDict(DictDef(self, 
                                           SomeImpossibleValue(),
                                           SomeImpossibleValue()))
-                self.immutable_cache[id(x)] = result
+                self.immutable_cache[key] = result
                 for ek, ev in x.iteritems():
                     result.dictdef.generalize_key(self.immutablevalue(ek))
                     result.dictdef.generalize_value(self.immutablevalue(ev))



More information about the Pypy-commit mailing list