Avoid infinite loop in uv export with conflicts (#12726)

## Summary

Closes https://github.com/astral-sh/uv/issues/12695.

Closes https://github.com/astral-sh/uv/issues/12719.
This commit is contained in:
Charlie Marsh 2025-04-07 15:10:58 -04:00 committed by GitHub
parent 1cca93c099
commit a0f5c7250b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 269 additions and 18 deletions

View file

@ -483,11 +483,12 @@ fn conflict_marker_reachability<'lock>(
// Combine the inferred marker with the existing marker on the node.
match reachability.entry(child_edge.target()) {
Entry::Occupied(existing) => {
Entry::Occupied(mut existing) => {
// If the marker is a subset of the existing marker (A ⊆ B exactly if
// A B = A), updating the child wouldn't change child's marker.
parent_marker.or(*existing.get());
if parent_marker != *existing.get() {
existing.insert(parent_marker);
queue.push(child_edge.target());
}
}
@ -496,8 +497,6 @@ fn conflict_marker_reachability<'lock>(
queue.push(child_edge.target());
}
}
queue.push(child_edge.target());
}
}