Irit Katriel <iritkatr...@gmail.com> added the comment:
1. I don't think we need such a clone of exception. We just need something like these two tests: @cpython_only def test_print_exception_bad_type_ct(self): with self.assertRaises(TypeError): from _testcapi import exception_print exception_print(42) def test_print_exception_bad_type_python(self): with self.assertRaises(TypeError): traceback.print_exception(42) It could be that they don't fit in BaseExceptionReportingTests because that is for tests that use get_report. It's fine of they are added separately. The python one can come after test_exception_is_None, and the C one perhaps after test_unhashable (and their names should be slightly different than above). 2. _testcapi is how you call into print_exception directly (for testing). If I remove the type check in _testcapi then the test above segfaults with Assertion failed: (PyExceptionInstance_Check(exc)), function _PyBaseExceptionObject_cast, file exceptions.c, line 321. This issue was created because Erlend found that the type check in print_exception is not covered by tests. It's possible that this check is in the wrong place at the moment. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45615> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com