-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix SetLayout to error with invalid int list input (#11653)
* Fix SetLayout to error with invalid int list input This commit fixes an issue in the SetLayout transpiler pass when an integer list is specified nothing was checking that the integer list contained unique entries. Previously if a list containing duplciate entries was passed in this would result in an invalid Layout object being set on the property set. This would cause a cryptic error message by later transpiler passes that would try and use that invalid Layout. This commit fixes this by detecting if there are duplicate entries in the int list and raising an exception directly. * Use new exception class in test
- Loading branch information
Showing
5 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
13 changes: 13 additions & 0 deletions
13
releasenotes/notes/add-invalid-layout-error-d0d64086748d4b54.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
features: | ||
- | | ||
Added a new exception class :class:`.InvalidLayoutError` that is a :class:`.TranspilerError` | ||
subclass which is raised when a user provided layout is invalid (mismatched size, duplicate | ||
qubits, etc). | ||
fixes: | ||
- | | ||
Fixed an issue with the :class:`.SetLayout` transpiler pass where an invalid integer list input | ||
that contained duplicate entries which would result in an invalid :class:`.Layout` being | ||
generated and subsequent transpiler passes would fail with a cryptic error. This is now caught | ||
when :meth:`.SetLayout.run` is called an :class:`.InvalidLayoutError` error will be raised | ||
indicating there are duplicate entries in the integer list. |
This file contains 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