-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-116436: Improve error message when TypeError occurs during dict update #116443
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
Conversation
Hopefully this is a good use of exception notes, since it's just adding context. If not, maybe something with |
@@ -3515,13 +3515,14 @@ merge_from_seq2_lock_held(PyObject *d, PyObject *seq2, int override) | |||
} | |||
|
|||
/* Convert item to sequence, and verify length 2. */ | |||
fast = PySequence_Fast(item, ""); | |||
fast = PySequence_Fast(item, "object is not iterable"); |
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.
Technically, I guess PyObject_GetIter
has a different error message for the edge case where __iter__
exists but returns a non-iterator.
I think nicest thing would be to change PySequence_Fast
so that if m
is NULL it doesn't clobber the message
The example I gave in the issue now looks like:
Previously it was just: