Skip to content

Commit

Permalink
Add back validation of parameters on gate methods
Browse files Browse the repository at this point in the history
In the previous commit a side effect of the accidental eager operation
creation was that the parameter input for gates were being validated by
that. By fixing that in the previous commit the validation of input
parameters on the circuit methods was broken. This commit fixes that
oversight and adds back the validation.
  • Loading branch information
mtreinish committed May 31, 2024
1 parent b35bdbd commit 3ea95de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/circuit/src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ impl StandardGate {
pub fn get_num_clbits(&self) -> u32 {
self.num_clbits()
}

#[getter]
pub fn get_name(&self) -> &str {
self.name()
}
}

// This must be kept up-to-date with `StandardGate` when adding or removing
Expand Down
3 changes: 3 additions & 0 deletions qiskit/circuit/quantumcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2315,6 +2315,9 @@ def _append_standard_gate(

expanded_qargs = [self.qbit_argument_conversion(qarg) for qarg in qargs or []]
expanded_cargs = [self.cbit_argument_conversion(carg) for carg in cargs or []]
if params is not None:
for param in params:
Gate.validate_parameter(op, param)

instructions = InstructionSet(resource_requester=circuit_scope.resolve_classical_resource)
broadcast_iter = Gate.broadcast_arguments(op, expanded_qargs, expanded_cargs)
Expand Down

0 comments on commit 3ea95de

Please sign in to comment.