This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch TINKERPOP-2279
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 2bb3330d8140792ea4ebd96e3f630402fcfb70e3
Author: Stephen Mallette <[email protected]>
AuthorDate: Thu Aug 22 11:23:46 2019 -0400

    Need to measure the byte length of string after utf-8 conversion
---
 .../src/main/jython/gremlin_python/structure/io/graphbinaryV1.py     | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphbinaryV1.py 
b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphbinaryV1.py
index 4e3a25d..bec5d94 100644
--- 
a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphbinaryV1.py
+++ 
b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphbinaryV1.py
@@ -376,9 +376,10 @@ class StringIO(_GraphBinaryTypeIO):
 
     @classmethod
     def dictify(cls, obj, writer, as_value=False, nullable=True):
+        str_bytes = obj.encode("utf-8")
         ba = bytearray()
-        ba.extend(struct.pack(">i", len(obj)))
-        ba.extend(obj.encode("utf-8"))
+        ba.extend(struct.pack(">i", len(str_bytes)))
+        ba.extend(str_bytes)
         return cls.as_bytes(cls.graphbinary_type, as_value, nullable, ba)
 
     @classmethod

Reply via email to