# If the following fails either
# the contains operator does not propagate UnicodeErrors or
# someone has changed the default encoding
- self.assertRaises(UnicodeError, 'g\xe2teau'.__contains__, u'\xe2')
+ self.assertRaises(UnicodeDecodeError, 'g\xe2teau'.__contains__, u'\xe2')
+ self.assertRaises(UnicodeDecodeError, u'g\xe2teau'.__contains__, '\xe2')
self.assertTrue(u'' in '')
self.assertTrue('' in u'')
self.assertTrue(u'asdf' not in u'')
self.assertRaises(TypeError, u"abc".__contains__)
+ self.assertRaises(TypeError, u"abc".__contains__, object())
def test_formatting(self):
string_tests.MixinStrUnicodeUserStringTest.test_formatting(self)
Core and Builtins
-----------------
+- Issue #1680159: unicode coercion during an 'in' operation no longer masks
+ the underlying error when the coercion fails for the left hand operand.
+
- Issue #7491: Metaclass's __cmp__ method was ignored.
- Issue #7466: segmentation fault when the garbage collector is called
/* Coerce the two arguments */
sub = PyUnicode_FromObject(element);
if (!sub) {
- PyErr_SetString(PyExc_TypeError,
- "'in <string>' requires string as left operand");
return -1;
}