gh-152490: Fix TypeError when formatting SyntaxError with msg=NotImplemented in traceback.py#152495
gh-152490: Fix TypeError when formatting SyntaxError with msg=NotImplemented in traceback.py#152495Aniketsy wants to merge 7 commits into
traceback.py#152495Conversation
| def test_syntax_error_with_not_implemented_msg(self): | ||
| exc = SyntaxError(NotImplemented) | ||
| lines = traceback.format_exception_only(type(exc), exc) | ||
| self.assertIsInstance("".join(lines), str) |
There was a problem hiding this comment.
Put that text under test_format_exception_only_exc please and rename it test_format_syntax_error and add an additoinal case inside it that checks a legitimate SyntaxError.
There was a problem hiding this comment.
thanks for the review, i've updated with the changes.
terryjreedy
left a comment
There was a problem hiding this comment.
I have no opinion on the test change.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
…8qLbF.rst Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
| with self.assertRaisesRegex(TypeError, 'required positional argument'): | ||
| traceback.format_exception(exc=e) | ||
|
|
||
| def test_format_exception_only_exc(self): |
| output = traceback.format_exception_only(Exception("projector")) | ||
| self.assertEqual(output, ["Exception: projector\n"]) | ||
|
|
||
| exc = SyntaxError(NotImplemented) |
There was a problem hiding this comment.
And create a separate test ror those cases.
Fixes #152490