-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Issue warning instead of error when parsing Enum while enum support is not enabled #42623
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
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 suggested using the warnings module instead because it is used in _recursive.py. I don't know enough about the details of logging libraries but I thought it would be a good idea to be consistent.
Consider also including information in the error message about how to enable experimental support (I remember seeing some env var you can set to do so).
torch/jit/annotations.py
Outdated
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.
| import logging | |
| import warnings |
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.
Done.
I think most of the times (by default) logging.warning and warning.warn behave exactly the same, unless configured otherwise:
https://stackoverflow.com/a/37979724
And not prompting user to set the environment variable is on purpose, the feature isn't complete after all.
torch/jit/annotations.py
Outdated
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.
| logging.warning("Enum support is work in progress, enum class {}" | |
| warnings.warn("Enum support is work in progress, enum class {}" |
facebook-github-bot
left a comment
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.
@gmagogsfm has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@gmagogsfm merged this pull request in 5d7c3f9. |
💊 CI failures summary and remediationsAs of commit bb41447 (more details on the Dr. CI page):
ci.pytorch.org: 1 failedThis comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 1 time. |
Returnning None rather than error matches previous behavior better.
Fixes https://fburl.com/yrrvtes3