Skip to content

Commit

Permalink
Fix: Adapt to Qiskit#12730
Browse files Browse the repository at this point in the history
  • Loading branch information
raynelfss committed Jul 24, 2024
1 parent 96bd389 commit 70eafce
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/accelerate/src/target_transpiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ use pyo3::{
types::{PyDict, PyList, PySet, PyTuple},
};

use qiskit_circuit::circuit_instruction::convert_py_to_operation_type;

use qiskit_circuit::operations::{Operation, OperationType, Param};
use qiskit_circuit::circuit_instruction::OperationFromPython;
use qiskit_circuit::operations::{Operation, Param};
use qiskit_circuit::packed_instruction::PackedOperation;
use smallvec::SmallVec;

use crate::nlayout::PhysicalQubit;
Expand Down Expand Up @@ -84,7 +84,7 @@ impl ToPyObject for TargetOperation {
impl TargetOperation {
fn num_qubits(&self) -> u32 {
match &self {
Self::Normal(normal) => normal.operation.num_qubits(),
Self::Normal(normal) => normal.operation.view().num_qubits(),
Self::Variadic(_) => {
unreachable!("'num_qubits' property is reserved for normal operations only.")
}
Expand All @@ -103,14 +103,14 @@ impl TargetOperation {
/// instance for caching purposes.
#[derive(Debug, Clone)]
pub(crate) struct NormalOperation {
pub operation: OperationType,
pub operation: PackedOperation,
pub params: SmallVec<[Param; 3]>,
op_object: PyObject,
}

impl<'py> FromPyObject<'py> for NormalOperation {
fn extract(ob: &'py PyAny) -> PyResult<Self> {
let operation = convert_py_to_operation_type(ob.py(), ob.into())?;
let operation: OperationFromPython = ob.extract()?;
Ok(Self {
operation: operation.operation,
params: operation.params,
Expand Down

0 comments on commit 70eafce

Please sign in to comment.