diff options
author | Helmut Grohne <helmut@subdivi.de> | 2015-04-16 17:43:11 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2015-04-16 17:43:11 +0200 |
commit | 621e4e5ed5783339973351aed5c0b08c22936c55 (patch) | |
tree | 92cd8b8e739be85986e65c27ea71714032b45cf4 /dedup | |
parent | 2a728ab85e1ddfeec03514f86f706c116ca94440 (diff) | |
download | debian-dedup-621e4e5ed5783339973351aed5c0b08c22936c55.tar.gz |
distinguish bytes from unicode for py3k
Diffstat (limited to 'dedup')
-rw-r--r-- | dedup/compression.py | 2 | ||||
-rw-r--r-- | dedup/hashing.py | 2 | ||||
-rw-r--r-- | dedup/image.py | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/dedup/compression.py b/dedup/compression.py index 4ce258c..4385f1d 100644 --- a/dedup/compression.py +++ b/dedup/compression.py @@ -62,7 +62,7 @@ class GzipDecompressor(object): else: expect = struct.pack("<ll", self.crc, self.size) if self.inbuffer.startswith(expect) and \ - self.inbuffer[len(expect):].replace("\0", "") == "": + self.inbuffer[len(expect):].replace(b"\0", b"") == b"": return b"" return self.inbuffer diff --git a/dedup/hashing.py b/dedup/hashing.py index a8a46c7..0b7f889 100644 --- a/dedup/hashing.py +++ b/dedup/hashing.py @@ -52,7 +52,7 @@ class HashBlacklistContent(object): # the chain avoids passing the empty sequence to max maxlen = max(itertools.chain((0,), itertools.imap(len, blacklist))) self.maxlen = maxlen - self.stored = "" + self.stored = b"" @property def name(self): diff --git a/dedup/image.py b/dedup/image.py index ef17989..314eb44 100644 --- a/dedup/image.py +++ b/dedup/image.py @@ -91,7 +91,7 @@ class GIFHash(ImageHash): if self.content.tell() < 10: # magic + logical dimension return False curvalue = self.content.getvalue() - if curvalue.startswith((b"GIF87a", "GIF89a")): + if curvalue.startswith((b"GIF87a", b"GIF89a")): width, height = struct.unpack("<HH", curvalue[6:10]) if width * height > self.maxpixels: raise ValueError("maximum image pixels exceeded") |