Skip to content

Use enums to validate their own values#2333

Open
mdboom wants to merge 1 commit into
NVIDIA:mainfrom
mdboom:cuda-core-enum-validation
Open

Use enums to validate their own values#2333
mdboom wants to merge 1 commit into
NVIDIA:mainfrom
mdboom:cuda-core-enum-validation

Conversation

@mdboom

@mdboom mdboom commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Previously there were a few places in the code base where we were validating enums by checking from a set of values (which were copied from the enum itself) and then raising an exception with the acceptable values (also copied from the enum itself). This is 3 places to keep in sync as the acceptable values change.

This uses a helper function to validate that a str is an acceptable value for an enum and provides a consistent error message.

@mdboom mdboom added this to the cuda.core next milestone Jul 9, 2026
@mdboom mdboom self-assigned this Jul 9, 2026
@mdboom mdboom added the cuda.core Everything related to the cuda.core module label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant