Skip to content

Commit 47d96b2

Browse files
authored
fix(encoding): always return bytes when decoding (#1220)
msgpack 1.0.0 has a different default behaviour which returns string rather than bytes. Keep it to bytes by default for all versions. Note that this is only used in testing anyway.
1 parent 40af970 commit 47d96b2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ddtrace/encoding.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ def encode(obj):
8383

8484
@staticmethod
8585
def decode(data):
86-
return msgpack.unpackb(data)
86+
if msgpack.version[:2] < (0, 6):
87+
return msgpack.unpackb(data)
88+
return msgpack.unpackb(data, raw=True)
8789

8890
@staticmethod
8991
def join_encoded(objs):

0 commit comments

Comments
 (0)