-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Deprecate unsafe legacy format in Solovay Kitaev #15360
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
base: main
Are you sure you want to change the base?
Conversation
|
One or more of the following people are relevant to this code:
|
| @deprecate_func( | ||
| since="2.1", | ||
| additional_msg="Use query_basic_approximation instead, which takes a Gate or matrix " | ||
| "as input and returns a QuantumCircuit object.", | ||
| pending=True, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to change to "since 2.3" now, I think
| with self.assertWarns(DeprecationWarning): | ||
| self.basic_approx = generate_basic_approximations([HGate(), TGate(), TdgGate()], 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you include the warning message in an assertWarnsRegex? Even from this PR, I can't really see why generate_basic_approximations should now raise a DeprecationWarning (isn't the only thing we newly raise related to loading them?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add the messages 👍🏻 I added the deprecation to both loading and generation (since nothing will be able to consume the deprecated format in the future)
| with self.assertWarns(DeprecationWarning): | ||
| basic_approx = generate_basic_approximations(["h", "t", "s"], 3) | ||
| sk = SolovayKitaev(3, basic_approx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which of these two calls is suppose to raise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You called out my laziness -- both are 🙂 Fixed now!
| with self.assertWarns(DeprecationWarning): | ||
| reference = SolovayKitaev(basic_approximations=gate_approx_library)(circuit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which of the calls is supposed to raise? (same question every time we have this pattern.) Can we make the warning catch stricter?
Pull Request Test Coverage Report for Build 19575376142Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Summary
Deprecate the legacy
.npyformat for serializing the basic approximations in Solovay Kitaev. This internally relies on pickle and could be potentially unsafe.