Skip to content

Commit dca47e7

Browse files
committed
catch a RecursionError when the recursion depth exceeds.
1 parent d28a9c8 commit dca47e7

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

veriloggen/dataflow/dataflow.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,17 @@ def implement(self, m, clock, reset, seq_name='seq', aswire=False):
4545
# for mult and div
4646
m._clock = clock
4747
m._reset = reset
48-
49-
dataflow_nodes = copy.deepcopy(self.nodes)
50-
48+
49+
try:
50+
dataflow_nodes = copy.deepcopy(self.nodes)
51+
except RecursionError:
52+
dataflow_nodes = self.nodes
53+
limit = sys.getrecursionlimit()
54+
print("Warning: Current dataflow definitions are not copied.", file=sys.stderr)
55+
print(" If object backup is required, enlarge maximum recursion depth"
56+
" by 'sys.setrecursionlimit(v)'.")
57+
print(" Current maximum depth is %d." % limit, file=sys.stderr)
58+
5159
input_visitor = visitor.InputVisitor()
5260
input_vars = set()
5361
for node in sorted(dataflow_nodes, key=lambda x:x.object_id):

0 commit comments

Comments
 (0)