Skip to content

Fix deepcopy/pickle of DAGCircuit variable IO nodes (backport #14041) #14044

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

Merged
merged 3 commits into from
Mar 18, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Mar 18, 2025

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.


This is an automatic backport of pull request #14041 done by Mergify.

* 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 mergify bot added the conflicts used by mergify when there are conflicts in a port label Mar 18, 2025
@mergify mergify bot requested a review from a team as a code owner March 18, 2025 10:05
Copy link
Contributor Author

mergify bot commented Mar 18, 2025

Cherry-pick of ddd0401 has failed:

On branch mergify/bp/stable/2.0/pr-14041
Your branch is up to date with 'origin/stable/2.0'.

You are currently cherry-picking commit ddd04013f.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   releasenotes/notes/fix-dag-var-out-pickle-a7d57e97a330e528.yaml
	modified:   test/python/dagcircuit/test_dagcircuit.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   crates/circuit/src/dag_circuit.rs

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

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

  • @Qiskit/terra-core

@github-actions github-actions bot added Changelog: Bugfix Include in the "Fixed" section of the changelog mod: transpiler Issues and PRs related to Transpiler labels Mar 18, 2025
@github-actions github-actions bot added this to the 2.0.0 milestone Mar 18, 2025
ElePT
ElePT previously approved these changes Mar 18, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 13924716828

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 18 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.02%) to 88.073%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 6 91.73%
crates/qasm2/src/parse.rs 12 97.15%
Totals Coverage Status
Change from base Build 13904878030: -0.02%
Covered Lines: 72684
Relevant Lines: 82527

💛 - Coveralls

@mtreinish mtreinish added this pull request to the merge queue Mar 18, 2025
Merged via the queue into stable/2.0 with commit fa470d7 Mar 18, 2025
22 checks passed
@mtreinish mtreinish deleted the mergify/bp/stable/2.0/pr-14041 branch April 29, 2025 23:18
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 conflicts used by mergify when there are conflicts in a port mod: transpiler Issues and PRs related to Transpiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants