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

Fix SetLayout to error with invalid int list input #11653

Merged
merged 3 commits into from
Jan 29, 2024

Conversation

mtreinish
Copy link
Member

Summary

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 duplicate 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.

Details and comments

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.
@mtreinish mtreinish requested a review from a team as a code owner January 26, 2024 20:24
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

@coveralls
Copy link

coveralls commented Jan 26, 2024

Pull Request Test Coverage Report for Build 7696225893

  • -1 of 8 (87.5%) changed or added relevant lines in 2 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.005%) to 89.556%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/transpiler/passes/layout/set_layout.py 5 6 83.33%
Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 3 91.94%
Totals Coverage Status
Change from base Build 7695410601: 0.005%
Covered Lines: 59560
Relevant Lines: 66506

💛 - Coveralls

@mtreinish mtreinish added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Jan 26, 2024
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this - it looks straightforwards and a good improvement to the user experience.

test/python/transpiler/test_setlayout.py Outdated Show resolved Hide resolved
@jakelishman jakelishman added this to the 1.0.0 milestone Jan 29, 2024
@jakelishman jakelishman added the mod: transpiler Issues and PRs related to Transpiler label Jan 29, 2024
@jakelishman jakelishman added this pull request to the merge queue Jan 29, 2024
Merged via the queue into Qiskit:main with commit 8af340c Jan 29, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog mod: transpiler Issues and PRs related to Transpiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants