-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Provide NameError/AttributeError suggestions in traceback.py #97008
Copy link
Copy link
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
Python 3.10 added NameError and AttributeError suggestions in raised exceptions, in the form of:
>>> dim
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'dim' is not defined. Did you mean: 'dir'?This is implemented in Python/suggestions.c and unavailable in the pure Python implementation of traceback formatting in Lib/traceback.py. This makes the output of both different, which is problematic for tooling using traceback.py, as well as for alternative implementations of Python like PyPy and GraalPy.
Let's implement the equivalent of suggestions.c in Lib/traceback.py to bring both in line.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement