-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
gh-99139: Improve NameError error suggestion for instances #99140
Conversation
pablogsal
commented
Nov 5, 2022
•
edited by bedevere-bot
Loading
edited by bedevere-bot
- Issue: Improve NameError error suggestion for instances #99139
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.
Looks great :)
Co-authored-by: Ammar Askar <ammar_askar@hotmail.com>
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.
Looks really helpful, thanks a lot @pablogsal!
|
🤖 New build scheduled with the buildbot fleet by @pablogsal for commit b1546e5 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
Co-authored-by: Ammar Askar <ammar_askar@hotmail.com>
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
|
🤖 New build scheduled with the buildbot fleet by @pablogsal for commit 4925719 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
| if (!locals) { | ||
| goto error; | ||
| } | ||
| PyObject* self = PyDict_GetItem(locals, &_Py_ID(self)); /* borrowed */ |
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.
Do not use PyDict_GetItem. It is broken by design.
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.
What should we use instead for both?
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.
PyDict_GetItemWithError and PyObject_GetAttr if limited by public API. It is suggested in the documentation. But _PyObject_LookupAttr is more convenient in the latter case.
| goto error; | ||
| } | ||
|
|
||
| if (PyObject_HasAttr(self, name)) { |
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.
Do not use PyObject_HasAttr. It is broken by design.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
