Author: Matti Picus <[email protected]>
Branch: py3.6
Changeset: r96441:4b54eb2f7e85
Date: 2019-04-11 08:30 +0300
http://bitbucket.org/pypy/pypy/changeset/4b54eb2f7e85/
Log: test, fix for u'a' < bytearray(b'a') which should raise
diff --git a/pypy/objspace/std/test/test_unicodeobject.py
b/pypy/objspace/std/test/test_unicodeobject.py
--- a/pypy/objspace/std/test/test_unicodeobject.py
+++ b/pypy/objspace/std/test/test_unicodeobject.py
@@ -201,6 +201,7 @@
assert not ('a' == 5)
assert 'a' != 5
raises(TypeError, "'a' < 5")
+ raises(TypeError, "'a' < bytearray(b'a')")
class AppTestUnicodeString:
diff --git a/pypy/objspace/std/unicodeobject.py
b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -329,7 +329,8 @@
def descr_lt(self, space, w_other):
try:
- res = self._utf8 < self.convert_arg_to_w_unicode(space,
w_other)._utf8
+ res = self._utf8 < self.convert_arg_to_w_unicode(space, w_other,
+ strict='__lt__')._utf8
except OperationError as e:
if e.match(space, space.w_TypeError):
return space.w_NotImplemented
@@ -338,7 +339,8 @@
def descr_le(self, space, w_other):
try:
- res = self._utf8 <= self.convert_arg_to_w_unicode(space,
w_other)._utf8
+ res = self._utf8 <= self.convert_arg_to_w_unicode(space, w_other,
+ strict='__le__')._utf8
except OperationError as e:
if e.match(space, space.w_TypeError):
return space.w_NotImplemented
@@ -347,7 +349,8 @@
def descr_gt(self, space, w_other):
try:
- res = self._utf8 > self.convert_arg_to_w_unicode(space,
w_other)._utf8
+ res = self._utf8 > self.convert_arg_to_w_unicode(space, w_other,
+ strict='__gt__')._utf8
except OperationError as e:
if e.match(space, space.w_TypeError):
return space.w_NotImplemented
@@ -356,7 +359,8 @@
def descr_ge(self, space, w_other):
try:
- res = self._utf8 >= self.convert_arg_to_w_unicode(space,
w_other)._utf8
+ res = self._utf8 >= self.convert_arg_to_w_unicode(space, w_other,
+ strict='__ge__')._utf8
except OperationError as e:
if e.match(space, space.w_TypeError):
return space.w_NotImplemented
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit