-
Notifications
You must be signed in to change notification settings - Fork 22.2k
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
stop allowing extra positional args in arg parser #10499
Conversation
Tests? (Also, I feel like the error messages could be improved more, but that can be for a later patch.) |
cc: @li-roy |
ping @li-roy about Ed's comment on tests. |
@pytorchbot retest this please |
test/test_torch.py
Outdated
@@ -7095,6 +7095,10 @@ def test_parsing_intlist(self): | |||
self.assertRaises(TypeError, lambda: torch.ones(np.array(3, 3))) | |||
self.assertRaises(TypeError, lambda: torch.ones((np.array(3, 3)))) | |||
|
|||
# fail parse with additional positional args after intlist arg | |||
self.assertRaises(TypeError, lambda: torch.LongTensor((6, 0), 1, 1, 0)) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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.
LGTM. Let me know what the error message looks like though (a self.assertRaisesRegex would be great)
@pytorchbot retest this please |
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.
li-roy has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Arg parser allowed additional positional args to be parsed into keyword-only params.
Fixes a couple cases:
Pre-fix:
Post-fix:
Pre-fix:
Post-fix:
fixes #8351