diff --git a/grammar.py b/grammar.py index ac89714..f77d7f4 100755 --- a/grammar.py +++ b/grammar.py @@ -28,6 +28,7 @@ import random import re import struct +import copy _INT_RANGES = { 'int': [-2147483648, 2147483647], @@ -283,7 +284,7 @@ def _generate_code(self, num_lines, initial_variables=[], last_var=0): self._add_variable('window', 'Window', context) while len(context['lines']) < num_lines: - tmp_context = context.copy() + tmp_context = copy.deepcopy(context) try: if (random.random() < self._interesting_line_prob) and (len(tmp_context['interesting_lines']) > 0): tmp_context['force_var_reuse'] = True