diff --git a/src/poetry/core/packages/dependency.py b/src/poetry/core/packages/dependency.py index 48a5ca88c..8715c27d6 100644 --- a/src/poetry/core/packages/dependency.py +++ b/src/poetry/core/packages/dependency.py @@ -574,7 +574,9 @@ def __eq__(self, other: object) -> bool: if not isinstance(other, Dependency): return NotImplemented - return super().__eq__(other) and self._constraint == other.constraint + return super().__eq__(other) and ( + self._constraint == other.constraint or self.is_direct_origin() + ) def __hash__(self) -> int: # don't include _constraint in hash because it is mutable!