@@ -1086,7 +1086,7 @@ def __init__(self, exc_type, exc_value, exc_traceback, *, limit=None,
10861086 self .exc_type_qualname = exc_type .__qualname__
10871087 self .exc_type_module = exc_type .__module__
10881088 if issubclass (exc_type , SyntaxError ):
1089- # Handle SyntaxError's specially
1089+ # Handle SyntaxErrors specially
10901090 self .filename = exc_value .filename
10911091 lno = exc_value .lineno
10921092 self .lineno = str (lno ) if lno is not None else None
@@ -1098,8 +1098,8 @@ def __init__(self, exc_type, exc_value, exc_traceback, *, limit=None,
10981098 self .msg = exc_value .msg
10991099 self ._is_syntax_error = True
11001100 self ._exc_metadata = getattr (exc_value , "_metadata" , None )
1101- elif suggestion := _compute_suggestion_message (exc_type , exc_value , exc_traceback ):
1102- if self ._str .endswith (('.' , '?' , '!' , '...' )):
1101+ elif suggestion := _suggestion_message (exc_type , exc_value , exc_traceback ):
1102+ if self ._str .endswith (('.' , '?' , '!' )):
11031103 punctuation = ''
11041104 else :
11051105 punctuation = '.'
@@ -1367,6 +1367,7 @@ def _find_keyword_typos(self):
13671367 self .msg = f"invalid syntax. Did you mean '{ suggestion } '?"
13681368 return
13691369
1370+
13701371 def _format_syntax_error (self , stype , ** kwargs ):
13711372 """Format SyntaxError exceptions (internal helper)."""
13721373 # Show exactly where the problem was found.
@@ -1559,6 +1560,7 @@ def format(self, *, chain=True, _ctx=None, **kwargs):
15591560 assert _ctx .exception_group_depth == 1
15601561 _ctx .exception_group_depth = 0
15611562
1563+
15621564 def print (self , * , file = None , chain = True , ** kwargs ):
15631565 """Print the result of self.format(chain=chain) to 'file'."""
15641566 colorize = kwargs .get ("colorize" , False )
@@ -1713,7 +1715,7 @@ def _compute_suggestion_error(exc_value, tb, wrong_name):
17131715 return suggestion
17141716
17151717
1716- def _compute_suggestion_message (exc_type , exc_value , exc_traceback ):
1718+ def _suggestion_message (exc_type , exc_value , exc_traceback ):
17171719 if (
17181720 issubclass (exc_type , ModuleNotFoundError )
17191721 and sys .flags .no_site
0 commit comments