Skip to content

Commit

Permalink
Added a shallow copy for blocks to prevent memory mutations in SCFG.i…
Browse files Browse the repository at this point in the history
…nsert_blocks
  • Loading branch information
kc611 committed Sep 14, 2023
1 parent 688b43b commit 6a18e03
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions numba_rvsdg/core/datastructures/scfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,11 @@ def insert_block(
block_type: SyntheticBlock
The type/class of the newly created block.
"""
# To prevent spurious mutations in successsors and predecessors
# since they are a part of the graph.
successors = successors.copy()
predecessors = predecessors.copy()

# TODO: needs a diagram and documentaion
# initialize new block
new_block = block_type(
Expand Down

0 comments on commit 6a18e03

Please sign in to comment.