Commit ede5dbc3 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Handle `u'' in ''`

parent 692017b5
......@@ -1757,6 +1757,14 @@ Box* strSwapcase(BoxedString* self) {
Box* strContains(BoxedString* self, Box* elt) {
assert(self->cls == str_cls);
if (PyUnicode_Check(elt)) {
int r = PyUnicode_Contains(self, elt);
if (r < 0)
throwCAPIException();
return boxBool(r);
}
if (elt->cls != str_cls)
raiseExcHelper(TypeError, "'in <string>' requires string as left operand, not %s", getTypeName(elt));
......
......@@ -57,3 +57,11 @@ for i in xrange(100):
# do some allocations:
for j in xrange(100):
[None] * j
print u'' in ''
print '' in u''
print u'aoeu' in ''
print u'\u0180' in 'hello world'
print 'hello world' in u'\u0180'
print u''.__contains__('')
print ''.__contains__(u'')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment