diff options
author | Robert Collins <robertc@robertcollins.net> | 2013-08-25 01:51:28 +1200 |
---|---|---|
committer | Robert Collins <robertc@robertcollins.net> | 2013-08-25 01:51:28 +1200 |
commit | 273a4c27aba153af19925c0e7f293d2d696fad7b (patch) | |
tree | 6c839c5c4538b80ce2875a51bde7f1d52e8601cd /python/subunit/v2.py | |
parent | f226d226e2a744b753b6b48ef8a3e7f7abba025e (diff) | |
download | subunit-git-273a4c27aba153af19925c0e7f293d2d696fad7b.tar.gz |
* Clients of subunit did not expect memoryview objects in StreamResult events.
(Robert Collins)
Diffstat (limited to 'python/subunit/v2.py')
-rw-r--r-- | python/subunit/v2.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/python/subunit/v2.py b/python/subunit/v2.py index 0a7796f..1f5bfc1 100644 --- a/python/subunit/v2.py +++ b/python/subunit/v2.py @@ -385,8 +385,10 @@ class ByteStreamToStreamResult(object): % (crc, packet_crc)) if safe_hasattr(builtins, 'memoryview'): body = memoryview(packet[-1]) + view = True else: body = packet[-1] + view = False # Discard CRC-32 body = body[:-4] # One packet could have both file and status data; the Python API @@ -421,6 +423,8 @@ class ByteStreamToStreamResult(object): content_length, consumed = self._parse_varint(body, pos) pos += consumed file_bytes = body[pos:pos+content_length] + if view: + file_bytes = file_bytes.tobytes() if len(file_bytes) != content_length: raise ParseError('File content extends past end of packet: ' 'claimed %d bytes, %d available' % ( |