From 7729239951b5561f5bb5c2d5152ff76833b11826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 8 Jan 2020 09:36:55 +0100 Subject: [PATCH] Fix deprecated calls for Python 3.9 The array methods fromstring/tostring have been deprecated since Python 3.2. Python 3.9 removes them completely. This was discovered when trying to build gitdb package for Fedora 33. https://bugzilla.redhat.com/show_bug.cgi?id=1788660 --- gitdb/pack.py | 2 +- gitdb/test/lib.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitdb/pack.py b/gitdb/pack.py index 115d943..2ad2324 100644 --- a/gitdb/pack.py +++ b/gitdb/pack.py @@ -410,7 +410,7 @@ def offsets(self): if self._version == 2: # read stream to array, convert to tuple a = array.array('I') # 4 byte unsigned int, long are 8 byte on 64 bit it appears - a.fromstring(buffer(self._cursor.map(), self._pack_offset, self._pack_64_offset - self._pack_offset)) + a.frombytes(buffer(self._cursor.map(), self._pack_offset, self._pack_64_offset - self._pack_offset)) # networkbyteorder to something array likes more if sys.byteorder == 'little': diff --git a/gitdb/test/lib.py b/gitdb/test/lib.py index ab1842d..42b9ddc 100644 --- a/gitdb/test/lib.py +++ b/gitdb/test/lib.py @@ -157,7 +157,7 @@ def make_bytes(size_in_bytes, randomize=False): random.shuffle(producer) # END randomize a = array('i', producer) - return a.tostring() + return a.tobytes() def make_object(type, data):