diff --git a/src/poetry/core/packages/dependency.py b/src/poetry/core/packages/dependency.py index a539d59b6..7b800fbdc 100644 --- a/src/poetry/core/packages/dependency.py +++ b/src/poetry/core/packages/dependency.py @@ -607,15 +607,21 @@ def __eq__(self, other: Any) -> bool: return ( self.is_same_package_as(other) - and self._constraint == other.constraint - and self._extras == other.extras + and self._constraint == other._constraint + and self._extras == other._extras + and self._marker == other._marker ) def __ne__(self, other: Any) -> bool: return not self.__eq__(other) def __hash__(self) -> int: - return super().__hash__() ^ hash(self._constraint) ^ hash(self._extras) + return ( + super().__hash__() + ^ hash(self._constraint) + ^ hash(self._extras) + ^ hash(self._marker) + ) def __str__(self) -> str: if self.is_root: diff --git a/src/poetry/core/version/markers.py b/src/poetry/core/version/markers.py index 7b2e98627..bb894028e 100644 --- a/src/poetry/core/version/markers.py +++ b/src/poetry/core/version/markers.py @@ -737,7 +737,9 @@ def _compact_markers(tree_elements: "Tree", tree_prefix: str = "") -> MarkerType ) value = value[1:-1] - groups[-1] = MultiMarker.of(groups[-1], SingleMarker(name, f"{op}{value}")) + groups[-1] = MultiMarker.of( + groups[-1], SingleMarker(str(name), f"{op}{value}") + ) elif token.data == f"{tree_prefix}BOOL_OP" and token.children[0] == "or": groups.append(MultiMarker())