New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-33159: Add name attribute to NameError #6271
Conversation
This is the first change to implement PEP 473. The plan is to add the attributes described in the PEP one exeption at a time, adjusting the most common places where the exceptions are raised to also include the structured data. Once the exceptions have been updated, the next step would be to update the Python code and the remaining places where exceptions are raised in the C code.
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
} | ||
|
||
static PyMemberDef NameError_members[] = { | ||
{"msg", T_OBJECT, offsetof(PyNameErrorObject, msg), 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why msg
and not message
, which is the name for this property in python 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The structure of this exception was modeled after the current implementation of ImportError
, which uses msg
.
Note that the message
attribute in exceptions have been deprecated since python 2.6 and has been removed in python 3. See PEP 352 for more details. I wonder though, why the msg
attribute was added to ImportError
.
That being said, I think that probably I just should remove the msg
field.
Any thoughts?
Any chance this PR could be reviewed at all? |
Looks like rejceted PEP .. |
The PEP was rejected because it was deemed to be to broad (see https://mail.python.org/pipermail/python-dev/2019-March/156692.html):
Should I open an issue in bpo, or should the discussion take place here? |
@sk- |
PEP 1 says where to discuss PEPs:
So please open a discussion thread on Python-Ideas or Discourse. And let's close this because PEP 473 was rejected. |
@hugovk Note that although the PEP was rejected they mentioned
Issue that I created https://bugs.python.org/issue37797, #81978 and has not received any replies either. Please reopen the PR or at least comment on the attached issue on why the change is not acceptable. |
Thanks, I hadn't seen that newer issue, re-opening! |
I don't think you should be mentioning 'PEP 473 Support' when it has been rejected. A bug report is ok. Also, need to re-target for 3.12. |
This is the first change to implement PEP 473.
The plan is to add the attributes described in the PEP one exeption at a time, adjusting the most common places where the exceptions are raised to also include the structured data.
Once the exceptions have been updated, the next step would be to update the Python code and the remaining places where exceptions are raised in the C code.
Note: This is my first PR to cpython, so if anything is amiss I would be happy to fix it.
See #81978, https://bugs.python.org/issue37797 and https://bugs.python.org/issue33159 for extra context.
https://bugs.python.org/issue33159