8000 gh-99139: Improve NameError error suggestion for instances by pablogsal · Pull Request #99140 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-99139: Improve NameError error suggestion for instances #99140

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

Merged
merged 7 commits into from
Nov 6, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update Python/suggestions.c
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
  • Loading branch information
pablogsal and isidentical authored Nov 6, 2022
commit d8933dd20198468692aad4cb1574fc96200d6406
1 change: 1 addition & 0 deletions Python/suggestions.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ get_suggestions_for_name_error(PyObject* name, PyFrameObject* frame)
}

if (PyObject_HasAttr(self, name)) {
Copy link
Member

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.

Py_DECREF(dir);
return PyUnicode_FromFormat("self.%S", name);
}
}
Expand Down
0