Skip to content

Commit 89242f3

Browse files
committed
Don't change NameError messages
Benefit isn't as clear as for `AttributeError` -- let's not change it if not necessary
1 parent 600ede5 commit 89242f3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/traceback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ def __init__(self, exc_type, exc_value, exc_traceback, *, limit=None,
11331133
# Prepend with a dot for better understanding. See GH-144285.
11341134
self._str += f". Did you mean '.{suggestion}' instead of '.{wrong_name}'?"
11351135
else: # NameError
1136-
self._str += f". Did you mean '{suggestion}' instead of '{wrong_name}'?"
1136+
self._str += f". Did you mean: '{suggestion}'?"
11371137
if issubclass(exc_type, NameError):
11381138
wrong_name = getattr(exc_value, "name", None)
11391139
if wrong_name is not None and wrong_name in sys.stdlib_module_names:

0 commit comments

Comments
 (0)