Author: Amaury Forgeot d'Arc <[email protected]>
Branch:
Changeset: r60497:9fe829a66345
Date: 2013-01-24 00:59 +0100
http://bitbucket.org/pypy/pypy/changeset/9fe829a66345/
Log: Propagate no_nul property in str.replace().
diff --git a/rpython/annotator/test/test_annrpython.py
b/rpython/annotator/test/test_annrpython.py
--- a/rpython/annotator/test/test_annrpython.py
+++ b/rpython/annotator/test/test_annrpython.py
@@ -3271,6 +3271,7 @@
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')
diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py
--- a/rpython/annotator/unaryop.py
+++ b/rpython/annotator/unaryop.py
@@ -509,7 +509,7 @@
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)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit