Skip to content

Conversation

@ryankert01
Copy link
Contributor

@ryankert01 ryankert01 commented Dec 30, 2025

Purpose of PR

This is a common pitfall in Qiskit development. Because QuantumCircuit objects are passed by reference in Python, methods like measure_all() or save_statevector() modify the original object, which can break iterative workflows (like Variational Quantum Eigensolvers or Trotterization) where the same base circuit is reused.

Related Issues or PRs

Closes #770

Changes Made

  • Bug fix
  • New feature
  • Refactoring
  • Documentation
  • Test
  • CI/CD pipeline
  • Other

Breaking Changes

  • Yes
  • No

Checklist

  • Added or updated unit tests for all changes
  • Added or updated documentation for all changes
  • Successfully built and ran all unit tests or manual tests locally
  • PR title follows "MAHOUT-XXX: Brief Description" format (if related to an issue)
  • Code follows ASF guidelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] In-place Circuit Mutation

1 participant