From 156962e5bfb898fcc496d8d65f135f670bd7d793 Mon Sep 17 00:00:00 2001 From: Chris Donati Date: Sat, 30 Mar 2019 14:58:01 -0700 Subject: [PATCH] Fix Versionstamp encoding issue for Value objects Python's struct.pack does not accept Value objects. --- bindings/python/fdb/tuple.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bindings/python/fdb/tuple.py b/bindings/python/fdb/tuple.py index 62fe258035..30748ae0eb 100644 --- a/bindings/python/fdb/tuple.py +++ b/bindings/python/fdb/tuple.py @@ -180,8 +180,11 @@ class Versionstamp(object): return "Versionstamp(" + repr(self.tr_version) + ", " + str(self.user_version) + ")" def to_bytes(self): + tr_version = self.tr_version + if isinstance(tr_version, fdb.impl.Value): + tr_version = tr_version.value return struct.pack(self._STRUCT_FORMAT_STRING, - self.tr_version if self.is_complete() else self._UNSET_TR_VERSION, + tr_version if self.is_complete() else self._UNSET_TR_VERSION, self.user_version) def completed(self, new_tr_version):