From bc88dae726a1a811ae301c23fa15ca91b7c26e72 Mon Sep 17 00:00:00 2001 From: Johnny Robeson Date: Sat, 18 Jun 2016 02:35:43 -0400 Subject: [PATCH] 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 --- beets/dbcore/query.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/beets/dbcore/query.py b/beets/dbcore/query.py index caf380260..8e2075f37 100644 --- a/beets/dbcore/query.py +++ b/beets/dbcore/query.py @@ -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)