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

FLAC objects that compare equal do not have the same hash value #603

Open
mahkitah opened this issue Mar 20, 2023 · 0 comments
Open

FLAC objects that compare equal do not have the same hash value #603

mahkitah opened this issue Mar 20, 2023 · 0 comments

Comments

@mahkitah
Copy link

mahkitah commented Mar 20, 2023

When you create two FLAC objects from the same file, they compare equal but they do not have the same hash value.
This is annoying when, for instance, you use sets to find duplicates. And it also goes against python 'regulations':

from Python docs
"The only required property is that objects which compare equal have the same hash value"

This issue may also apply to other types, but I only tested this for FLAC.

>>> from mutagen.flac import FLAC
>>> path = "myflac.flac"
>>> f1 = FLAC(path)
>>> f2 = FLAC(path)
>>> f1 == f2
True
>>> hash(f1) == hash(f2)
False
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

No branches or pull requests

1 participant