Author: Maciej Fijalkowski <[email protected]>
Branch: gc-minimark-pinning
Changeset: r55076:652a64986b9b
Date: 2012-05-14 10:56 +0200
http://bitbucket.org/pypy/pypy/changeset/652a64986b9b/
Log: test and fix
diff --git a/pypy/annotation/test/test_annrpython.py
b/pypy/annotation/test/test_annrpython.py
--- a/pypy/annotation/test/test_annrpython.py
+++ b/pypy/annotation/test/test_annrpython.py
@@ -3756,6 +3756,18 @@
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]
diff --git a/pypy/annotation/unaryop.py b/pypy/annotation/unaryop.py
--- a/pypy/annotation/unaryop.py
+++ b/pypy/annotation/unaryop.py
@@ -497,7 +497,7 @@
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):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit