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
Throw error for unsupported dunder methods #8602
Conversation
Make jitclass throw an error rather than ignore unhandled `__X__` methods.
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.
Thanks for the patch. One minor comment to resolve else looks good.
if ( | ||
name.startswith("__") | ||
and name.endswith("__") | ||
and name not in supported_dunders | ||
): | ||
continue | ||
raise TypeError("Method {0} is not supported".format(name)) |
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.
Suggest adding a unit test that checks this error message is raised as expected to numba.tests.test_jitclasses
.
Ensure forbidden dunder methods are not created.
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.
@apmasell many thanks for adding the test. Couple of minor things to resolve else looks good.
Co-authored-by: stuartarchibald <stuartarchibald@users.noreply.github.com>
Co-authored-by: stuartarchibald <stuartarchibald@users.noreply.github.com>
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.
Thanks for the patch and fixes!
Make jitclass throw an error rather than ignore unhandled
__X__
methods.