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 deepcopy/pickle of DAGCircuit variable IO nodes #14041

Merged
merged 3 commits into from
Mar 18, 2025

Conversation

kevinhartman
Copy link
Contributor

Summary

Fixes a typo we've had for a while in DAGCircuit::pack_into that would cause Var output nodes to become input nodes during deepcopy or pickling.

Details and comments

The DAGCircuit::pack_into method is only called with IO nodes from within DAGCircuit::__setstate__, so this bug would only trigger for deep-copied or un-pickled DAGs with variables.

@kevinhartman kevinhartman requested a review from a team as a code owner March 17, 2025 21:03
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@kevinhartman kevinhartman added Changelog: Bugfix Include in the "Fixed" section of the changelog mod: transpiler Issues and PRs related to Transpiler stable backport potential The bug might be minimal and/or import enough to be port to stable labels Mar 17, 2025
@kevinhartman kevinhartman linked an issue Mar 17, 2025 that may be closed by this pull request
@kevinhartman kevinhartman added this to the 2.0.0 milestone Mar 17, 2025
@kevinhartman kevinhartman self-assigned this Mar 17, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 13909797891

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 16 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.01%) to 88.072%

Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/unitary_synthesis.rs 1 94.69%
crates/qasm2/src/expr.rs 1 94.23%
crates/qasm2/src/parse.rs 6 97.61%
crates/qasm2/src/lex.rs 8 91.48%
Totals Coverage Status
Change from base Build 13905217637: -0.01%
Covered Lines: 72589
Relevant Lines: 82420

💛 - Coveralls

@mtreinish
Copy link
Member

@Mergifyio backport stable/1.4

Copy link
Contributor

mergify bot commented Mar 17, 2025

backport stable/1.4

✅ Backports have been created

Copy link
Contributor

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

The fix looks straightforward. LGTM!

@ElePT ElePT added this pull request to the merge queue Mar 18, 2025
Merged via the queue into Qiskit:main with commit ddd0401 Mar 18, 2025
23 checks passed
mergify bot pushed a commit that referenced this pull request Mar 18, 2025
* Fix var DAGOutNode bug in DAGCircuit::pack_into.

We were accidentally using NodeType::VarIn when extracting DAGOutNode.

* Add release note since this is pre 2.0.0.

(cherry picked from commit ddd0401)

# Conflicts:
#	crates/circuit/src/dag_circuit.rs
mergify bot pushed a commit that referenced this pull request Mar 18, 2025
* Fix var DAGOutNode bug in DAGCircuit::pack_into.

We were accidentally using NodeType::VarIn when extracting DAGOutNode.

* Add release note since this is pre 2.0.0.

(cherry picked from commit ddd0401)

# Conflicts:
#	crates/circuit/src/dag_circuit.rs
github-merge-queue bot pushed a commit that referenced this pull request Mar 18, 2025
… (#14043)

* Fix deepcopy/pickle of `DAGCircuit` variable IO nodes (#14041)

* Fix var DAGOutNode bug in DAGCircuit::pack_into.

We were accidentally using NodeType::VarIn when extracting DAGOutNode.

* Add release note since this is pre 2.0.0.

(cherry picked from commit ddd0401)

# Conflicts:
#	crates/circuit/src/dag_circuit.rs

* Fix conflict

---------

Co-authored-by: Kevin Hartman <[email protected]>
Co-authored-by: Elena Peña Tapia <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Mar 18, 2025
… (#14044)

* Fix deepcopy/pickle of `DAGCircuit` variable IO nodes (#14041)

* Fix var DAGOutNode bug in DAGCircuit::pack_into.

We were accidentally using NodeType::VarIn when extracting DAGOutNode.

* Add release note since this is pre 2.0.0.

(cherry picked from commit ddd0401)

# Conflicts:
#	crates/circuit/src/dag_circuit.rs

* Update dag_circuit.rs

* Update crates/circuit/src/dag_circuit.rs

---------

Co-authored-by: Kevin Hartman <[email protected]>
Co-authored-by: Elena Peña Tapia <[email protected]>
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 stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DAGCircuit with vars does not compare equal after pickling
5 participants