From 4d9a2344bb4fde27992cc3511af87d01b51622fa Mon Sep 17 00:00:00 2001 From: Mark Hodson Date: Thu, 6 Jul 2023 12:27:55 +0930 Subject: [PATCH] Fix: the shallow copy() method needs to copy the declarations --- pyquil/quil.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyquil/quil.py b/pyquil/quil.py index a9ebdc469..e11c89634 100644 --- a/pyquil/quil.py +++ b/pyquil/quil.py @@ -200,8 +200,9 @@ def copy(self) -> "Program": :return: a new Program """ - new_prog = self.copy_everything_except_instructions() + new_prog = self.copy_everything_except_instructions() # and declarations, which is a view new_prog._instructions = self._instructions.copy() + new_prog._declarations = self._declarations.copy() return new_prog @property