1. Pypy
  2. Untitled project
  3. pypy

Commits

Amaury Forgeot d'Arc  committed 9fe829a

Propagate no_nul property in str.replace().

  • Participants
  • Parent commits d4c3010
  • Branches default

Comments (0)

Files changed (2)

File rpython/annotator/test/test_annrpython.py

View file
  • Ignore whitespace
         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')

File rpython/annotator/unaryop.py

View file
  • Ignore whitespace
         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)