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

arigo at codespeak.net arigo at codespeak.net
Fri Jun 17 23:26:34 CEST 2005


Author: arigo
Date: Fri Jun 17 23:26:32 2005
New Revision: 13560

Modified:
   pypy/dist/pypy/annotation/unaryop.py
Log:
Details.


Modified: pypy/dist/pypy/annotation/unaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/unaryop.py	(original)
+++ pypy/dist/pypy/annotation/unaryop.py	Fri Jun 17 23:26:32 2005
@@ -236,9 +236,7 @@
     def len(lst):
         s_item = lst.listdef.read_item()
         if isinstance(s_item, SomeImpossibleValue):
-            r = SomeInteger(nonneg=True)
-            r.const = 0
-            return r
+            return immutablevalue(0)
         return SomeObject.len(lst)
 
     def iter(lst):
@@ -252,10 +250,8 @@
     def len(dct):
         s_key = dct.dictdef.read_key()
         s_value = dct.dictdef.read_value()
-        if isinstance(s_key, SomeImpossibleValue) and isinstance(s_value, SomeImpossibleValue):
-            r = SomeInteger(nonneg=True)
-            r.const = 0
-            return r
+        if isinstance(s_key, SomeImpossibleValue) or isinstance(s_value, SomeImpossibleValue):
+            return immutablevalue(0)
         return SomeObject.len(dct)
 
     def iter(dct):
@@ -442,7 +438,8 @@
         return ll_to_annotation(v)
 
     def len(p):
-        return ll_to_annotation(len(p.ll_ptrtype._example()))
+        len(p.ll_ptrtype._example())   # just doing checking
+        return SomeObject.len(p)
 
     def setattr(p, s_attr, s_value): # just doing checking
         assert s_attr.is_constant(), "getattr on ptr %r with non-constant field-name" % p.ll_ptrtype



More information about the Pypy-commit mailing list