-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Unify cast_error message thrown by [simple|unpacking]_collector #3013
Conversation
Closing and reopening to trigger CI. |
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 don't have historical background to know why the messages aren't uniform, but it seems likely to me that this simply didn't get enough attention and just slipped through the cracks. I think this is a good change to make. My only suggestion is to add simple unit tests for both, if possible actually one unit test that exercises both implementations, to ensure that the implementations are being kept consistent in the future.
simple_collector and unpacking_collector throw different error messages when the casting of an argument failed: While the former mentions make_tuple(), the latter emphasises the call argument (and its name/position).
…to guarantee uniformity.
I rebased this branch on current master and added a commit to consolidate the error reporting code. Waiting for the CI to finish. |
@Skylion007 Could you please take another look? With respect to my comment from June 1: #3013 (review) When looking at this PR again today, I decided it's better to ensure uniformity at the root (and reduce code duplication) rather than asserting something about the results (commit 53fc821). I verified that the existing unit tests cover both call paths affected by the commit. |
Thanks @rhaschke for initiating this PR, and thanks @Skylion007 for the review! |
simple_collector
andunpacking_collector
throw different error messages when the casting of an argument failed:While the former mentioned
make_tuple()
, the latter emphasizes the call argument (and its name/position):pybind11/include/pybind11/cast.h
Lines 1307 to 1309 in ad6bf5c
This PR unifies both usages to use the latter (more informative) one.
If there was a reason to have different error messages for both collector variants, please feel free to close this PR.
Suggested changelog entry: