Skip to content

Commit

Permalink
Add comment to explain unwraps.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhartman committed Sep 19, 2024
1 parent 591b0cb commit 2a0951f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/circuit/src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2123,6 +2123,8 @@ impl Operation for PyInstruction {
return vec![];
}
Python::with_gil(|py| -> Vec<CircuitData> {
// We expect that if PyInstruction::control_flow is true then the operation WILL
// have a 'blocks' attribute which is a tuple of the Python QuantumCircuit.
let raw_blocks = self.instruction.getattr(py, "blocks").unwrap();
let blocks: &Bound<PyTuple> = raw_blocks.downcast_bound::<PyTuple>(py).unwrap();
blocks
Expand Down

0 comments on commit 2a0951f

Please sign in to comment.