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

pedronis at codespeak.net pedronis at codespeak.net
Wed Jun 15 02:05:43 CEST 2005


Author: pedronis
Date: Wed Jun 15 02:05:42 2005
New Revision: 13421

Modified:
   pypy/dist/pypy/annotation/bookkeeper.py
Log:
immutablevalue for lists and dicts was not guarding for recursion adequately



Modified: pypy/dist/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/dist/pypy/annotation/bookkeeper.py	(original)
+++ pypy/dist/pypy/annotation/bookkeeper.py	Wed Jun 15 02:05:42 2005
@@ -180,18 +180,21 @@
             try:
                 return self.immutable_cache[id(x)]
             except KeyError:
-                items_s = [self.immutablevalue(e) for e in x]
-                result = SomeList(ListDef(self, unionof(*items_s)))
+                result = SomeList(ListDef(self, SomeImpossibleValue()))
                 self.immutable_cache[id(x)] = 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)]
             except KeyError:
-                keys_s   = [self.immutablevalue(e) for e in x.keys()]
-                values_s = [self.immutablevalue(e) for e in x.values()]
-                result = SomeDict(DictDef(self, unionof(*keys_s),
-                                          unionof(*values_s)))
+                result = SomeDict(DictDef(self, 
+                                          SomeImpossibleValue(),
+                                          SomeImpossibleValue()))
                 self.immutable_cache[id(x)] = result
+                for ek, ev in e.iteritems():
+                    result.dictdef.generalize_key(immutablevalue(ek))
+                    result.dictdef.generalize_key(immutablevalue(ek))
         elif ishashable(x) and x in BUILTIN_ANALYZERS:
             result = SomeBuiltin(BUILTIN_ANALYZERS[x])
         elif isinstance(x, lltype._ptr):



More information about the Pypy-commit mailing list