From 76f7dffdd50f129706c2065bd48de279eefc6a6d Mon Sep 17 00:00:00 2001 From: Raynel Sanchez <87539502+raynelfss@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:46:38 -0500 Subject: [PATCH] Fix: Discard cache when assigning new parameters in `CircuitData`. --- crates/circuit/src/circuit_data.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/circuit/src/circuit_data.rs b/crates/circuit/src/circuit_data.rs index 1c12aef9efc7..699ad5f3d1c0 100644 --- a/crates/circuit/src/circuit_data.rs +++ b/crates/circuit/src/circuit_data.rs @@ -1394,13 +1394,7 @@ impl CircuitData { // Standard gates can all rebuild their definitions, so if the // cached py_op exists, update the `params` attribute and clear out // any existing cache. - if let Some(borrowed) = previous.py_op.get() { - borrowed - .bind(py) - .getattr(params_attr)? - .set_item(parameter, new_param)?; - borrowed.bind(py).setattr("_definition", py.None())? - } + previous.py_op.take(); } } else { // Track user operations we've seen so we can rebind their definitions.