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: Gate instructions specified as tuples no longer error when using a list of parameters. #1716

Conversation

MarquessV
Copy link
Contributor

Description

Closes #1700

Checklist

  • The PR targets the master branch
  • The above description motivates these changes.
  • The change is atomic and can be described by a single commit (your PR will be squashed on merge).
  • All changes to code are covered via unit tests.
  • Parameters and return values have type hints with PEP 484 syntax.
  • Functions and classes have useful Sphinx-style docstrings.
  • (Bugfix) The associated issue is referenced above using auto-close keywords.

@MarquessV MarquessV requested a review from a team as a code owner December 14, 2023 17:57
@MarquessV MarquessV linked an issue Dec 14, 2023 that may be closed by this pull request
@rigetti-githubbot
Copy link

rigetti-githubbot commented Dec 14, 2023

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
7087 6214 88% 87% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
pyquil/quil.py 83% 🟢
TOTAL 83% 🟢

updated for commit: 7474bbf by action🐍

Copy link
Contributor

@Shadow53 Shadow53 left a comment

Choose a reason for hiding this comment

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

Agree with deprecating the support for tuples. One comment on making a check a little more robust, but otherwise looks good.

if len(instruction) == 2:
self.measure(instruction[1], None)
else:
self.measure(instruction[1], instruction[2])
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this else check for len == 3 and raise an exception if len > 3?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, but this is how it was written in pyQuil 3, and since this code exists purely for backwards compatibility, I'm hesitant to add a new error case.

@MarquessV MarquessV enabled auto-merge (squash) December 15, 2023 18:16
@MarquessV MarquessV disabled auto-merge December 15, 2023 18:16
@MarquessV MarquessV merged commit 5ae22f1 into master Dec 15, 2023
22 checks passed
@MarquessV MarquessV deleted the 1700-programinst-using-a-tuple-no-longer-works-for-parametric-gates branch December 15, 2023 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

program.inst() using a tuple no longer works for parametric gates
4 participants