diff --git a/src/Mod/Path/PathScripts/PathUtils.py b/src/Mod/Path/PathScripts/PathUtils.py index 8f96f47a9e..690a435c78 100644 --- a/src/Mod/Path/PathScripts/PathUtils.py +++ b/src/Mod/Path/PathScripts/PathUtils.py @@ -742,10 +742,11 @@ def sort_jobs(locations, keys, attractors=[]): def find_closest(location_list, location, dist): q = PriorityQueue() - for j in location_list: - q.put((dist(j, location) + weight(j), j)) + for i,j in enumerate(location_list): + # prevent dictionary comparison by inserting the index + q.put((dist(j, location) + weight(j), i, j)) - prio, result = q.get() + prio, i, result = q.get() return result