Commits

Amaury Forgeot d'Arc committed 6e9bda8

Propagate no-NULness in str.replace()

Comments (0)

Files changed (2)

pypy/annotation/test/test_annrpython.py

         a = self.RPythonAnnotator()
         s = a.build_types(f, [str])
         assert isinstance(s, annmodel.SomeString)
+        assert s.no_nul
 
         def f(x):
             return u'a'.replace(x, u'b')

pypy/annotation/unaryop.py

         return getbookkeeper().newlist(s_item)
 
     def method_replace(str, s1, s2):
-        return str.basestringclass()
+        return str.basestringclass(no_nul=str.no_nul and s2.no_nul)
 
     def getslice(str, s_start, s_stop):
         check_negative_slice(s_start, s_stop)