/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/smart/message.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-22 00:56:52 UTC
  • mfrom: (6621.2.26 py3_pokes)
  • Revision ID: jelmer@jelmer.uk-20170522005652-yjahcr9hwmjkno7n
Merge Python3 porting work ('py3 pokes')

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from __future__ import absolute_import
18
18
 
19
19
import collections
20
 
from cStringIO import StringIO
21
20
 
22
 
from breezy import (
 
21
from .. import (
23
22
    debug,
24
23
    errors,
25
24
    )
26
 
from breezy.trace import mutter
 
25
from ..sixish import (
 
26
    BytesIO,
 
27
    )
 
28
from ..trace import mutter
27
29
 
28
30
 
29
31
class MessageHandler(object):
245
247
        self._bytes_parts.append(bytes)
246
248
 
247
249
    def structure_part_received(self, structure):
248
 
        if type(structure) is not tuple:
 
250
        if not isinstance(structure, tuple):
249
251
            raise errors.SmartProtocolError(
250
252
                'Args structure is not a sequence: %r' % (structure,))
251
253
        if not self._body_started:
324
326
            body_bytes = ''.join(self._bytes_parts)
325
327
            if 'hpss' in debug.debug_flags:
326
328
                mutter('              %d body bytes read', len(body_bytes))
327
 
            self._body = StringIO(body_bytes)
 
329
            self._body = BytesIO(body_bytes)
328
330
            self._bytes_parts = None
329
331
        return self._body.read(count)
330
332