You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2019/09/10 14:13:53 UTC
[tinkerpop] 07/07: Fixed bug in python 2.7 support for request
message serialization
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 de695017f8dfe4649bf20e2e88524f22c9e7b4c1
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Tue Sep 10 10:13:09 2019 -0400
Fixed bug in python 2.7 support for request message serialization
---
.../src/main/jython/gremlin_python/driver/serializer.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/gremlin-python/src/main/jython/gremlin_python/driver/serializer.py b/gremlin-python/src/main/jython/gremlin_python/driver/serializer.py
index b66086c..d6b20d4 100644
--- a/gremlin-python/src/main/jython/gremlin_python/driver/serializer.py
+++ b/gremlin-python/src/main/jython/gremlin_python/driver/serializer.py
@@ -175,7 +175,8 @@ class GraphBinarySerializersV1(object):
DEFAULT_WRITER_CLASS = graphbinaryV1.GraphBinaryWriter
DEFAULT_VERSION = b"application/vnd.graphbinary-v1.0"
- header_struct = struct.Struct('>b32sB16B')
+ max_int64 = 0xFFFFFFFFFFFFFFFF
+ header_struct = struct.Struct('>b32sBQQ')
header_pack = header_struct.pack
int_pack = graphbinaryV1.int32_pack
@@ -226,7 +227,10 @@ class GraphBinarySerializersV1(object):
def finalize_message(self, message, mime_len, mime_type):
ba = bytearray()
- ba.extend(self.header_pack(mime_len, mime_type, 0x81, *uuid.UUID(message['requestId']).bytes))
+
+ request_id = uuid.UUID(message['requestId'])
+ ba.extend(self.header_pack(mime_len, mime_type, 0x81,
+ (request_id.int >> 64) & self.max_int64, request_id.int & self.max_int64))
op_bytes = message['op'].encode("utf-8")
ba.extend(self.int_pack(len(op_bytes)))