aboutsummaryrefslogtreecommitdiffhomepage
path: root/python
diff options
context:
space:
mode:
authorGravatar Jisi Liu <liujisi@google.com>2017-10-18 12:56:04 -0700
committerGravatar GitHub <noreply@github.com>2017-10-18 12:56:04 -0700
commit30bfe36b6aabc970f8d700d037eb70a8a80cf336 (patch)
tree65d4a65eb71dfe29465dc36ae1e562e17fb11cb8 /python
parentdc9190f2f5aa3a045b189281f6238cfd5e5006b3 (diff)
parent08334f0908991601152a103cf2934f991bab2efd (diff)
Merge pull request #3736 from jleni/fix_rbpi
Fix: Truncated Message due to "TypeError: unhashable type: 'bytearray'"
Diffstat (limited to 'python')
-rwxr-xr-xpython/google/protobuf/internal/decoder.py2
-rwxr-xr-xpython/google/protobuf/internal/encoder.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/python/google/protobuf/internal/decoder.py b/python/google/protobuf/internal/decoder.py
index ff3e6d30..52b64915 100755
--- a/python/google/protobuf/internal/decoder.py
+++ b/python/google/protobuf/internal/decoder.py
@@ -181,7 +181,7 @@ def ReadTag(buffer, pos):
while six.indexbytes(buffer, pos) & 0x80:
pos += 1
pos += 1
- return (buffer[start:pos], pos)
+ return (six.binary_type(buffer[start:pos]), pos)
# --------------------------------------------------------------------
diff --git a/python/google/protobuf/internal/encoder.py b/python/google/protobuf/internal/encoder.py
index 8c6a1189..40c62d67 100755
--- a/python/google/protobuf/internal/encoder.py
+++ b/python/google/protobuf/internal/encoder.py
@@ -418,7 +418,7 @@ def _VarintBytes(value):
def TagBytes(field_number, wire_type):
"""Encode the given tag and return the bytes. Only called at startup."""
- return _VarintBytes(wire_format.PackTag(field_number, wire_type))
+ return six.binary_type( _VarintBytes(wire_format.PackTag(field_number, wire_type)) )
# --------------------------------------------------------------------
# As with sizers (see above), we have a number of common encoder