From cbcfda214be4e53943f25c581de7570a8fac83ba Mon Sep 17 00:00:00 2001 From: Filipp Ozinov Date: Fri, 14 Oct 2022 10:01:45 +0400 Subject: [PATCH] #155 - FutureWarning on GzipFile --- pysyncobj/serializer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pysyncobj/serializer.py b/pysyncobj/serializer.py index 6bb227c..9454f6d 100644 --- a/pysyncobj/serializer.py +++ b/pysyncobj/serializer.py @@ -85,7 +85,7 @@ def serialize(self, data, id): self.__serializer(tmpFile, data[1:]) else: with open(tmpFile, 'wb') as f: - with gzip.GzipFile(fileobj=f) as g: + with gzip.GzipFile(fileobj=f, mode='wb') as g: pickle.dump(data, g) atomicReplace(tmpFile, self.__fileName) @@ -102,7 +102,7 @@ def serialize(self, data, id): def deserialize(self): if self.__fileName is None: with BytesIO(self.__inMemorySerializedData) as io: - with gzip.GzipFile(fileobj=io) as g: + with gzip.GzipFile(fileobj=io, mode='rb') as g: return pickle.load(g) if self.__deserializer is not None: