You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2019-08-09.00:30:15.063>labels= ['interpreter-core', 'type-feature', '3.9']
title='Add name attribute to NameError'updated_at=<Date2019-08-24.14:34:03.068>user='https://github.com/sk'
This issue is requesting the addition of the optional attribute name to NameError.
The idea of having a structured attribute is to allow tools to act upon these exceptions. For example you could imagine a test runner which detect typos and suggests the right name to use.
There is a current PR (#6271) adding this functionality, but it may need to be rebased as it has been awaiting a reply since April last year.
Activity
sk commentedon Aug 9, 2019
PEP-473 was recently rejected (https://mail.python.org/pipermail/python-dev/2019-March/156692.html) because it was too broad and was suggested to be broken down in smaller issues.
This issue is requesting the addition of the optional attribute
nametoNameError.The idea of having a structured attribute is to allow tools to act upon these exceptions. For example you could imagine a test runner which detect typos and suggests the right name to use.
There is a current PR (#6271) adding this functionality, but it may need to be rebased as it has been awaiting a reply since April last year.
cmaloney commentedon Nov 9, 2025
This was added in Python 3.10 as part of gh-82711: https://docs.python.org/3/library/exceptions.html#NameError.name
StanFromIreland commentedon Nov 9, 2025
I suggest you close as duplicate rather than completed.