Skip to content
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

[BUG] Fix handling of fromstring() for invalid enums #887

Closed
parthosa opened this issue Mar 26, 2024 · 0 comments · Fixed by #1300
Closed

[BUG] Fix handling of fromstring() for invalid enums #887

parthosa opened this issue Mar 26, 2024 · 0 comments · Fixed by #1300
Assignees
Labels
bug Something isn't working user_tools Scope the wrapper module running CSP, QualX, and reports (python)

Comments

@parthosa
Copy link
Collaborator

parthosa commented Mar 26, 2024

Currently we depend on EnumeratedType.fromstring() to manage invalid enum arguments by raising an exception. However, it returns None for invalid values, instead of throwing an exception. Thus the intended default value, which is set in the exception handling branch, is never applied.

For example,

try:
  selected_recommendation = QualGpuClusterReshapeType.fromstring(arg_val)
except Exception:  # pylint: disable=broad-except
  => execution never reaches here in case of invalid enum
  selected_recommendation = QualGpuClusterReshapeType.fromstring(default_recommendation_txt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working user_tools Scope the wrapper module running CSP, QualX, and reports (python)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants