Skip to content

Commit 7c9d457

Browse files
committed
Updated putOpaque to avoid bytes typing
1 parent b58e475 commit 7c9d457

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pynuodb/encodedsession.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,12 +445,12 @@ def putOpaque(self, value):
445445
"""Appends an Opaque data value to the message."""
446446
data = value.string
447447
length = len(data)
448+
if systemVersion is '3' and type(value) is bytes:
449+
data = data.decode('latin-1')
448450
if length < 40:
449451
packed = chr(protocol.OPAQUELEN0 + length) + data
450452
else:
451453
lengthStr = toByteString(length)
452-
if systemVersion is '3':
453-
data = data.decode('latin-1')
454454
packed = chr(protocol.OPAQUECOUNT1 - 1 + len(lengthStr)) + lengthStr + data
455455
self.__output += packed
456456
return self

0 commit comments

Comments
 (0)