-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-137508: Unify error messages for index() and remove() #139696
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
base: main
Are you sure you want to change the base?
gh-137508: Unify error messages for index() and remove() #139696
Conversation
Unify error messages for the index() and remove() methods of classes list, tuple, range, memoryview, str, bytes, bytearray, array.array, and collections.deque, and the operator.indexOf() function. Improve error message for xml.etree.ElementTree.Element.remove().
return NULL; | ||
} | ||
PyErr_SetString(PyExc_ValueError, "list.remove(x): x not in list"); | ||
PyErr_SetString(PyExc_ValueError, "value not in list"); |
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.
To me this just makes the messages slightly less informative. Personally, I don't see this as an improvement.
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.
I am not so strong proponent of this change, but I think that there is a benefit of having unified error messages whether it is possible. I'll left this PR until we have an overwhelming support of any variant.
} | ||
} | ||
PyErr_SetString(PyExc_ValueError, "deque.index(x): x not in deque"); | ||
PyErr_SetString(PyExc_ValueError, "value not in deque"); |
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.
I prefer the message be left as-is.
Unify error messages for the index() and remove() methods of classes list, tuple, range, memoryview, str, bytes, bytearray, array.array, and collections.deque, and the operator.indexOf() function.
Improve error message for xml.etree.ElementTree.Element.remove().
<sequence>.<method>()
failures #137508