Make InQuery hashable when its pattern is a list#6838
Merged
snejus merged 1 commit intoJul 15, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6838 +/- ##
=======================================
Coverage 74.91% 74.91%
=======================================
Files 163 163
Lines 21172 21174 +2
Branches 3341 3341
=======================================
+ Hits 15860 15862 +2
Misses 4545 4545
Partials 767 767
🚀 New features to boost your workflow:
|
InQuery inherited FieldQuery.__hash__, which hashes the pattern directly. A list pattern raises `unhashable type: 'list'`, which broke the smartplaylist `splupdate` command whenever a `playlist:` query was configured.
snejus
force-pushed
the
fix/inquery-unhashable-pattern
branch
from
July 15, 2026 07:02
e64c918 to
eb7c832
Compare
snejus
enabled auto-merge
July 15, 2026 07:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5354.
beet splupdateraisesTypeError: unhashable type: 'list'whenever a smartplaylist configuration contains aplaylist:query. smartplaylist collects playlists in aset, which hashes the query.playlist:parses toPlaylistQuery, a subclass ofInQuerywhosepatternis a list, andInQueryinheritedFieldQuery.__hash__, which doeshash(self.pattern)and fails on a list.As @wisp3rwind suggested on the issue, this overrides
__hash__onInQueryto hash a tuple copy of the pattern. It stays order-sensitive to match the inheritedFieldQuery.__eq__, so the hash/eq contract holds.Changes:
beets/dbcore/query.py: addInQuery.__hash__.test/dbcore/test_query.py: regression test that anInQuerywith a list pattern can be put in a set.Left the order-insensitive
__eq__/__hash__and the smartplaylistset-vs-dictcleanup you also floated out of scope here; happy to follow up on either if you want them.