Repository navigation
Check the name and the factory given to register_quantum_system - #409
Merged
anthony-santana merged 2 commits intoNov 30, 2026
Merged
anthony-santana merged 2 commits into
anthony-santana merged 2 commits into
Conversation
A name that is not a str failed with a built-in TypeError, and a factory that is not callable was registered and failed only when the system was first asked for. Both now raise InvalidTypeError at registration, and nothing is registered. Closes NVIDIA#392 Signed-off-by: Shubham <[email protected]>
Several open pull requests add their entry at the top of the list, so each conflicts with the others as they merge. The entry is unchanged. Signed-off-by: A.M. Santana <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes and why
Closes #392.
register_quantum_systemnow checks what it is given before it registers anything:strraisesInvalidTypeError("a quantum system name is a str, got int") instead of a built-inTypeErrorfrom deeper in the registry;InvalidTypeErrornaming the system, at registration time, instead of being stored and failing only when the system is first looked up.The factory check runs after the existing name check, and in both cases nothing is added to the registry, so a failed call leaves it unchanged. The tests cover an int and a bytes name, an int and a str factory, and confirm the registry is untouched afterwards. There is a changelog entry under
### Fixed.Checklist
cmake --build build/dev --target check-pulsepasses (lit and pytest). (CPU build,CUDAQ_PULSE_ENABLE_GPU=OFF: lit 130/130, pytest 12946 passed / 86 skipped, cuDensityMat host and classical handler tests pass.)pre-commit run --all-filesandMYPYPATH=build/dev/python mypy -p cudaq_pulsepass.CHANGELOG.md(## [X.Y.Z] - Unreleased).CONTRIBUTING.md. (Not breaking: only inputs that could never work are rejected earlier.)Signed-off-by:line (Developer Certificate of Origin,CONTRIBUTING.md).