-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix type of basis_gates
in BasicSimulator
configuration
#13385
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
Conversation
`basis_gates` was getting set to `Target.operation_names`, which is a `dict_keys` instance (maybe that should be changed to a more basic type?), while typically `basis_gates` is a list. `dict_keys` instances can not be deep copied, so code that usually deep copies a backend's configuration could not work. Deep copying the configuration can happen for example when using the `BasicSimulator` with sampler class like `qiskit_ibm_runtime.SamplerV2` that puts the backend into its options and then tries to deep copy the options.
One or more of the following people are relevant to this code:
|
The configuration model is deprecated any way, but I think it is worth treating this as a bugfix since it blocks a usage pattern that is not trying to use the configuration. It came up in Qiskit Slack here. |
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.
Thanks Will, this seems straightforward and eases a pain point in the transition. I'll backport it to the 1.2 series, though at present we hadn't been planning to push out a further release on that branch. If it's a big annoyance, it's easy for us to put out a new patch release.
Pull Request Test Coverage Report for Build 11614986392Details
💛 - Coveralls |
`basis_gates` was getting set to `Target.operation_names`, which is a `dict_keys` instance (maybe that should be changed to a more basic type?), while typically `basis_gates` is a list. `dict_keys` instances can not be deep copied, so code that usually deep copies a backend's configuration could not work. Deep copying the configuration can happen for example when using the `BasicSimulator` with sampler class like `qiskit_ibm_runtime.SamplerV2` that puts the backend into its options and then tries to deep copy the options. (cherry picked from commit 09d1006)
…13386) `basis_gates` was getting set to `Target.operation_names`, which is a `dict_keys` instance (maybe that should be changed to a more basic type?), while typically `basis_gates` is a list. `dict_keys` instances can not be deep copied, so code that usually deep copies a backend's configuration could not work. Deep copying the configuration can happen for example when using the `BasicSimulator` with sampler class like `qiskit_ibm_runtime.SamplerV2` that puts the backend into its options and then tries to deep copy the options. (cherry picked from commit 09d1006) Co-authored-by: Will Shanks <willshanks@us.ibm.com>
basis_gates
was getting set toTarget.operation_names
, which is adict_keys
instance (maybe that should be changed to a more basic type?), while typicallybasis_gates
is a list.dict_keys
instances can not be deep copied, so code that usually deep copies a backend's configuration could not work. Deep copying the configuration can happen for example when using theBasicSimulator
with sampler class likeqiskit_ibm_runtime.SamplerV2
that puts the backend into its options and then tries to deep copy the options.