Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VersionRange objects are unhashable #20

Closed
Hritik14 opened this issue Jan 8, 2022 · 0 comments · Fixed by #21
Closed

VersionRange objects are unhashable #20

Hritik14 opened this issue Jan 8, 2022 · 0 comments · Fixed by #21

Comments

@Hritik14
Copy link
Collaborator

Hritik14 commented Jan 8, 2022

Is this by design ? It doesn't seem like it because of hash=True in https://github.com/nexB/univers/blob/a52ea9900d87ef6cd0ed989bf20a41a794cf39c4/src/univers/version_range.py#L18

>>> vr = NginxVersionRange.from_string("vers:nginx/3")
>>> X = set()
>>> X.add(vr)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-15-25340b8f0bdf> in <module>
----> 1 X.add(vr)

<attrs generated hash univers.version_range.VersionRange> in __hash__(self)
      1 def __hash__(self):
----> 2         return hash((
      3                 938370967647186531,
      4                 self.constraints,
      5             ))
TypeError: unhashable type: 'list'
pombredanne added a commit that referenced this issue Jan 10, 2022
See #20
We now ensure that a `version_constraints` attribute is a tuple 

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
@Hritik14 Hritik14 linked a pull request Jan 11, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant