fix Constraint.allows_any() wrong for in/not in with compound constraints by dimbleby · Pull Request #927 · python-poetry/poetry-core (original) (raw)
[](/apps/sourcery-ai)
Bot reviewed Mar 21, 2026
radoering changed the title
fix Constraint.allows_any() wrong for in/not in with compound constra… fix Constraint.allows_any() wrong for in/not in with compound constraints
…ints
Constraint.allows_any() only returned True for the '!=' operator when the other argument was a MultiConstraint or UnionConstraint. This caused incorrect False results for 'in' and 'not in' operators.
For MultiConstraint (AND): check that self is compatible with each individual constraint via all(self.allows_any(c) ...).
For UnionConstraint (OR): check if self overlaps any member via any(self.allows_any(c) ...).
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
dimbleby deleted the fix/constraint-allows-any-compound branch
This was referenced
Mar 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})