yield
if msg is None:
self.assertEqual(str(caught.exception).split(':')[0],
- str(exctype))
+ exctype.__name__)
else:
self.assertEqual(str(caught.exception),
- "{}: {}".format(exctype, msg))
+ "{}: {}".format(exctype.__name__, msg))
def test_invalid_syntax(self):
with self.assert_run_failed(SyntaxError):
@unittest.skipIf(_interpreters is None, 'subinterpreters required')
class IncompatibleExtensionModuleRestrictionsTests(unittest.TestCase):
- ERROR = re.compile("^<class 'ImportError'>: module (.*) does not support loading in subinterpreters")
+ ERROR = re.compile("^ImportError: module (.*) does not support loading in subinterpreters")
def run_with_own_gil(self, script):
interpid = _interpreters.create(isolated=True)
assert(exc != NULL);
const char *failure = NULL;
- PyObject *nameobj = PyUnicode_FromFormat("%S", Py_TYPE(exc));
+ PyObject *nameobj = PyUnicode_FromString(Py_TYPE(exc)->tp_name);
if (nameobj == NULL) {
failure = "unable to format exception type name";
goto error;