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/04 20:16:48 UTC
[tinkerpop] 03/06: Allow serializer to re-use the initialized
bytearray avoiding creation of new ones
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 8353e39b2d3e7671efa33b4105082946dd4cef92
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Wed Sep 4 13:34:21 2019 -0400
Allow serializer to re-use the initialized bytearray avoiding creation of new ones
---
gremlin-python/src/main/jython/gremlin_python/driver/serializer.py | 7 +++++--
1 file changed, 5 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 a0493f4..ef31819 100644
--- a/gremlin-python/src/main/jython/gremlin_python/driver/serializer.py
+++ b/gremlin-python/src/main/jython/gremlin_python/driver/serializer.py
@@ -236,14 +236,17 @@ class GraphBinarySerializersV1(object):
args = message["args"]
ba.extend(struct.pack(">i", len(args)))
for k, v in args.items():
- ba.extend(self._graphbinary_writer.writeObject(k))
+ self._graphbinary_writer.toDict(k, ba)
# processor_obj.get_op_args in serialize_message() seems to already handle bytecode. in python 3
# because bytearray isn't bound to a type in graphbinary it falls through the writeObject() and
# just works but python 2 bytearray is bound to ByteBufferType so it writes DataType.bytebuffer
# rather than DataType.bytecode and the server gets confused. special casing this for now until
# it can be refactored
- ba.extend(v if k == "gremlin" else self._graphbinary_writer.writeObject(v))
+ if k == "gremlin":
+ ba.extend(v)
+ else:
+ self._graphbinary_writer.toDict(v, ba)
return bytes(ba)