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

Parameter cache is preserved after copy_empty_like #12617

Closed
nkanazawa1989 opened this issue Jun 20, 2024 · 2 comments · Fixed by #12619
Closed

Parameter cache is preserved after copy_empty_like #12617

nkanazawa1989 opened this issue Jun 20, 2024 · 2 comments · Fixed by #12619
Labels
bug Something isn't working

Comments

@nkanazawa1989
Copy link
Contributor

nkanazawa1989 commented Jun 20, 2024

Environment

  • Qiskit version: main
  • Python version:
  • Operating system:

What is happening?

Parameter appears in empty circuit after copy

How can we reproduce the issue?

p1 = Parameter("P1")
qc = QuantumCircuit(1)
qc.rz(p1, 0)
qc.parameters  # dummy call to fill cache

cpy = qc.copy_empty_like()
cpy.parameters

I see

ParameterView([Parameter(P1)])

which should not exist.

What should happen?

Parameter should be empty

Any suggestions?

Nullify _parameters after copy

@nkanazawa1989 nkanazawa1989 added the bug Something isn't working label Jun 20, 2024
@jakelishman
Copy link
Member

Thanks for the report Naoki. I think this has actually been in existence for some time, more than just the Rust changes.

@jakelishman
Copy link
Member

Yeah, this appears to be in 1.1 and 0.46 - might well have been around for a long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants