Skip to content

Commit 03f2acd

Browse files
authored
Make sure that cached values from links_and_reverse_links_dict are not mutable inside (#826)
Yay python, it's great... In 20b45ba we made sure that we'd return read only dicts from this function since it's caching the result, but we kinda forgot that the value was a set and thus was still mutable... This commits freezes said sets so now those objects should be properly read only...
1 parent f73212c commit 03f2acd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/taskgraph/graph.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ def links_and_reverse_links_dict(self):
133133
for left, right, _ in self.edges:
134134
forward[left].add(right)
135135
reverse[right].add(left)
136-
return (ReadOnlyDict(forward), ReadOnlyDict(reverse))
136+
137+
return (
138+
ReadOnlyDict({key: frozenset(value) for key, value in forward.items()}),
139+
ReadOnlyDict({key: frozenset(value) for key, value in reverse.items()}),
140+
)
137141

138142
def links_dict(self):
139143
"""

0 commit comments

Comments
 (0)