From fdfce5314195d1b03fe30ee907468f875773acaf Mon Sep 17 00:00:00 2001 From: albi3ro Date: Mon, 17 Jun 2024 17:06:28 -0400 Subject: [PATCH] once again try to iterate over the annotated queue --- pennylane/queuing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pennylane/queuing.py b/pennylane/queuing.py index b3805e1c233..ffb35bd9165 100644 --- a/pennylane/queuing.py +++ b/pennylane/queuing.py @@ -576,7 +576,9 @@ def process_queue( list_order = {"_ops": 1, "_measurements": 2} current_list = "_ops" - for obj in queue.queue: + # cant use for obj in queue.queue, as OperatorRecorder overrides the definition of queue + # cant use for obj in queue, as QuantumTape overrides the definition of __iter__ + for obj, _ in queue.items(): if not hasattr(obj, "_queue_category"): raise QueuingError( f"{obj} encountered in AnnotatedQueue and is not an object that can "