21 lines
767 B
Diff
21 lines
767 B
Diff
# UNDF: UNDF-2026-000000046
|
|
--- a/distlib/database.py
|
|
+++ b/distlib/database.py
|
|
@@ -1277,10 +1277,13 @@ def get_dependent_dists(dists, dist):
|
|
graph = make_graph(dists)
|
|
|
|
- dep = [dist] # dependent distributions
|
|
+ dep = [dist] # dependent distributions (ordered output list)
|
|
+ dep_set = {dist} # O(1) membership mirror of dep
|
|
todo = graph.reverse_list[dist] # list of nodes we should inspect
|
|
|
|
while todo:
|
|
d = todo.pop()
|
|
dep.append(d)
|
|
+ dep_set.add(d)
|
|
for succ in graph.reverse_list[d]:
|
|
- if succ not in dep:
|
|
+ if succ not in dep_set: # O(1) instead of O(N) list scan
|
|
todo.append(succ)
|
|
|
|
dep.pop(0) # remove dist from dep, was there to prevent infinite loops
|