From 8167a9fda628ef3631339cf00aab5f50d20499ac Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Thu, 24 Sep 2020 11:01:35 -0400 Subject: [PATCH] All tests pass on Python 3. --- src/allmydata/mutable/filenode.py | 2 +- src/allmydata/mutable/retrieve.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/allmydata/mutable/filenode.py b/src/allmydata/mutable/filenode.py index 48ce5d8b7..04342dca0 100644 --- a/src/allmydata/mutable/filenode.py +++ b/src/allmydata/mutable/filenode.py @@ -946,7 +946,7 @@ class MutableFileVersion(object): """ c = consumer.MemoryConsumer(progress=progress) d = self.read(c, fetch_privkey=fetch_privkey) - d.addCallback(lambda mc: "".join(mc.chunks)) + d.addCallback(lambda mc: b"".join(mc.chunks)) return d diff --git a/src/allmydata/mutable/retrieve.py b/src/allmydata/mutable/retrieve.py index fde762d29..a7785e4c5 100644 --- a/src/allmydata/mutable/retrieve.py +++ b/src/allmydata/mutable/retrieve.py @@ -743,7 +743,7 @@ class Retrieve(object): block_and_salt, blockhashes, sharehashes = results block, salt = block_and_salt - _assert(type(block) is str, (block, salt)) + _assert(isinstance(block, bytes), (block, salt)) blockhashes = dict(enumerate(blockhashes)) self.log("the reader gave me the following blockhashes: %s" % \ @@ -847,7 +847,7 @@ class Retrieve(object): # d.items()[0] is like (shnum, (block, salt)) # d.items()[0][1] is like (block, salt) # d.items()[0][1][1] is the salt. - salt = blocks_and_salts.items()[0][1][1] + salt = list(blocks_and_salts.items())[0][1][1] # Next, extract just the blocks from the dict. We'll use the # salt in the next step. share_and_shareids = [(k, v[0]) for k, v in blocks_and_salts.items()] @@ -870,7 +870,7 @@ class Retrieve(object): else: d = defer.maybeDeferred(self._segment_decoder.decode, shares, shareids) def _process(buffers): - segment = "".join(buffers) + segment = b"".join(buffers) self.log(format="now decoding segment %(segnum)s of %(numsegs)s", segnum=segnum, numsegs=self._num_segments,