diff -r d6c7ab5a2065 Lib/test/string_tests.py --- a/Lib/test/string_tests.py Thu Sep 11 10:56:59 2014 +0300 +++ b/Lib/test/string_tests.py Fri Sep 12 14:47:46 2014 +0800 @@ -65,14 +65,12 @@ self.assertTrue(object is not realresult) # check that object.method(*args) raises exc - def checkraises(self, exc, object, methodname, *args): - object = self.fixtype(object) + def checkraises(self, exc, obj, methodname, *args): + obj = self.fixtype(obj) args = self.fixtype(args) - self.assertRaises( - exc, - getattr(object, methodname), - *args - ) + with self.assertRaises(exc) as cm: + getattr(obj, methodname)(*args) + self.assertNotEqual(cm.exception.message, '') # call object.method(*args) without any checks def checkcall(self, object, methodname, *args): @@ -1057,6 +1055,7 @@ self.checkequal('a b c', ' ', 'join', BadSeq2()) self.checkraises(TypeError, ' ', 'join') + self.checkraises(TypeError, ' ', 'join', None) self.checkraises(TypeError, ' ', 'join', 7) self.checkraises(TypeError, ' ', 'join', Sequence([7, 'hello', 123L])) try: diff -r d6c7ab5a2065 Lib/test/test_string.py --- a/Lib/test/test_string.py Thu Sep 11 10:56:59 2014 +0300 +++ b/Lib/test/test_string.py Fri Sep 12 14:47:46 2014 +0800 @@ -16,13 +16,10 @@ realresult ) - def checkraises(self, exc, object, methodname, *args): - self.assertRaises( - exc, - getattr(string, methodname), - object, - *args - ) + def checkraises(self, exc, obj, methodname, *args): + with self.assertRaises(exc) as cm: + getattr(string, methodname)(obj, *args) + self.assertNotEqual(cm.exception.message, '') def checkcall(self, object, methodname, *args): getattr(string, methodname)(object, *args) diff -r d6c7ab5a2065 Lib/test/test_userstring.py --- a/Lib/test/test_userstring.py Thu Sep 11 10:56:59 2014 +0300 +++ b/Lib/test/test_userstring.py Fri Sep 12 14:47:46 2014 +0800 @@ -28,14 +28,12 @@ realresult ) - def checkraises(self, exc, object, methodname, *args): - object = self.fixtype(object) + def checkraises(self, exc, obj, methodname, *args): + obj = self.fixtype(obj) # we don't fix the arguments, because UserString can't cope with it - self.assertRaises( - exc, - getattr(object, methodname), - *args - ) + with self.assertRaises(exc) as cm: + getattr(obj, methodname)(*args) + self.assertNotEqual(cm.exception.message, '') def checkcall(self, object, methodname, *args): object = self.fixtype(object) diff -r d6c7ab5a2065 Objects/stringobject.c --- a/Objects/stringobject.c Thu Sep 11 10:56:59 2014 +0300 +++ b/Objects/stringobject.c Fri Sep 12 14:47:46 2014 +0800 @@ -1594,7 +1594,7 @@ Py_ssize_t i; PyObject *seq, *item; - seq = PySequence_Fast(orig, ""); + seq = PySequence_Fast(orig, "can only join an iterable"); if (seq == NULL) { return NULL; }