mirror of
https://github.com/beetbox/beets.git
synced 2026-01-04 15:03:22 +01:00
rework basestring check in BytesQuery
This makes it possible for this query to work in both py2 and py3, since strings are bytes in py2
This commit is contained in:
parent
33d451ed2d
commit
bc88dae726
1 changed files with 1 additions and 3 deletions
|
|
@ -246,9 +246,7 @@ class BytesQuery(MatchQuery):
|
|||
# Use a buffer representation of the pattern for SQLite
|
||||
# matching. This instructs SQLite to treat the blob as binary
|
||||
# rather than encoded Unicode.
|
||||
if isinstance(self.pattern, basestring):
|
||||
# Implicitly coerce Unicode strings to their bytes
|
||||
# equivalents.
|
||||
if isinstance(self.pattern, (unicode, bytes)):
|
||||
if isinstance(self.pattern, unicode):
|
||||
self.pattern = self.pattern.encode('utf8')
|
||||
self.buf_pattern = buffer(self.pattern)
|
||||
|
|
|
|||
Loading…
Reference in a new issue