bpo-45826: Fix a crash in suggestions.c by checking for traceback is None#29590
bpo-45826: Fix a crash in suggestions.c by checking for traceback is None#29590ambv merged 5 commits intopython:mainfrom
traceback is None#29590Conversation
| // Abort if we don't have a variable name or we have an invalid one | ||
| // or if we don't have a traceback to work with | ||
| if (name == NULL || traceback == NULL || !PyUnicode_CheckExact(name)) { | ||
| if (name == NULL || !PyUnicode_CheckExact(name) || |
There was a problem hiding this comment.
Instead of checking for None, we can check if the traceback object parent class is the traceback type (.PyTraceBack_Type) . This way we also stop segfaults if someone placed any other object there
There was a problem hiding this comment.
Isn't tb_next is supposed to be None or a Traceback? Regardless, I agree that it is more clear to just check for type.
|
Thanks @sweeneyde for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10. |
|
Sorry @sweeneyde and @ambv, I had trouble checking out the |
…back is None` (pythonGH-29590) (cherry picked from commit 5d90c46) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
|
GH-29602 is a backport of this pull request to the 3.10 branch. |
https://bugs.python.org/issue45826