Commits

Maciej Fijalkowski committed b45dc15

test and fix

Comments (0)

Files changed (2)

pypy/annotation/test/test_annrpython.py

         s = a.build_types(main, [int])
         assert isinstance(s, annmodel.SomeInteger)
 
+    def test_join_none_and_nonnull(self):
+        from pypy.rlib.rstring import assert_str0
+        
+        def f(i):
+            a = str(i)
+            a = assert_str0(a)
+            return a.join([None])
+
+        a = self.RPythonAnnotator()
+        s = a.build_types(f, [int])
+        assert isinstance(s, annmodel.SomeString)
+        assert not s.can_be_None
 
 def g(n):
     return [0,1,2,n]

pypy/annotation/unaryop.py

             if isinstance(str, SomeUnicodeString):
                 return immutablevalue(u"")
             return immutablevalue("")
-        no_nul = str.no_nul and s_item.no_nul
+        no_nul = str.no_nul and getattr(s_item, 'no_nul', True)
         return str.basestringclass(no_nul=no_nul)
 
     def iter(str):