Skip to content

Commit

Permalink
Allow comparison between subclasses of Requirement and Marker
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Jan 21, 2022
1 parent 2a56fd1 commit 3005d18
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packaging/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def __hash__(self) -> int:
return hash((self.__class__.__name__, str(self)))

def __eq__(self, other: Any) -> bool:
if self.__class__ != other.__class__:
if not isinstance(other, Marker):
return NotImplemented

return _flatten_marker(self._markers) == _flatten_marker(other._markers)
Expand Down
2 changes: 1 addition & 1 deletion packaging/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def __hash__(self) -> int:
return hash((self.__class__.__name__, str(self)))

def __eq__(self, other: Any) -> bool:
if self.__class__ != other.__class__:
if not isinstance(other, Requirement):
return NotImplemented

return bool(
Expand Down

0 comments on commit 3005d18

Please sign in to comment.