[pypy-commit] pypy default: Fix for issue #2019
arigo
noreply at buildbot.pypy.org
Fri Apr 10 09:53:44 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r76769:adfa94ce2ed9
Date: 2015-04-10 09:53 +0200
http://bitbucket.org/pypy/pypy/changeset/adfa94ce2ed9/
Log: Fix for issue #2019
diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py
--- a/rpython/annotator/unaryop.py
+++ b/rpython/annotator/unaryop.py
@@ -501,12 +501,18 @@
return SomeInteger(nonneg=True)
def method_strip(self, chr=None):
+ if chr is None and isinstance(self, SomeUnicodeString):
+ raise AnnotatorError("unicode.strip() with no arg is not RPython")
return self.basestringclass(no_nul=self.no_nul)
def method_lstrip(self, chr=None):
+ if chr is None and isinstance(self, SomeUnicodeString):
+ raise AnnotatorError("unicode.lstrip() with no arg is not RPython")
return self.basestringclass(no_nul=self.no_nul)
def method_rstrip(self, chr=None):
+ if chr is None and isinstance(self, SomeUnicodeString):
+ raise AnnotatorError("unicode.rstrip() with no arg is not RPython")
return self.basestringclass(no_nul=self.no_nul)
def method_join(self, s_list):
diff --git a/rpython/rtyper/test/test_runicode.py b/rpython/rtyper/test/test_runicode.py
--- a/rpython/rtyper/test/test_runicode.py
+++ b/rpython/rtyper/test/test_runicode.py
@@ -306,3 +306,11 @@
assert res == False
res = self.interpret(f, [2])
assert res == True
+
+ def test_strip_no_arg(self):
+
+ def f():
+ return u'abcdef'.strip()
+
+ e = py.test.raises(Exception, self.interpret, f, [])
+ assert "unicode.strip() with no arg is not RPython" in str(e.value)
More information about the pypy-commit
mailing list