Bug 1788660 - python-gitdb fails to build with Python 3.9: array.tostring got removed
Summary: python-gitdb fails to build with Python 3.9: array.tostring got removed
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-gitdb
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lubomír Sedlář
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON39
TreeView+ depends on / blocked
 
Reported: 2020-01-07 17:51 UTC by Miro Hrončok
Modified: 2020-01-08 10:11 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-01-08 09:10:29 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Miro Hrončok 2020-01-07 17:51:14 UTC
python-gitdb fails to build with Python 3.9.0a2.

======================================================================
ERROR: test_large_data_streaming (gitdb.test.performance.test_stream.TestObjDBPerformance)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/test/lib.py", line 72, in wrapper
    return func(self, *args, **kwargs)
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/test/lib.py", line 87, in wrapper
    return func(self, path)
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/test/performance/test_stream.py", line 58, in test_large_data_streaming
    size, stream = make_memory_file(self.large_data_size_bytes, randomize)
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/test/lib.py", line 172, in make_memory_file
    d = make_bytes(size_in_bytes, randomize)
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/test/lib.py", line 160, in make_bytes
    return a.tostring()
AttributeError: 'array.array' object has no attribute 'tostring'
-------------------- >> begin captured logging << --------------------
root: INFO: You can set the GITDB_TEST_GIT_REPO_BASE environment variable to a .git repository of your choice - defaulting to the gitdb repository
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: test_pack_entity (gitdb.test.test_pack.TestPack)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/test/lib.py", line 87, in wrapper
    return func(self, path)
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/test/test_pack.py", line 179, in test_pack_entity
    assert entity.is_valid_stream(info.binsha, use_crc=True)
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/pack.py", line 829, in is_valid_stream
    next_offset = self._offset_map[offset]
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/util.py", line 256, in __getattr__
    self._set_cache_(attr)
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/pack.py", line 688, in _set_cache_
    offsets_sorted = sorted(self._index.offsets())
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/pack.py", line 413, in offsets
    a.fromstring(buffer(self._cursor.map(), self._pack_offset, self._pack_64_offset - self._pack_offset))
AttributeError: 'array.array' object has no attribute 'fromstring'

======================================================================
ERROR: test_pack_index (gitdb.test.test_pack.TestPack)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/test/test_pack.py", line 134, in test_pack_index
    self._assert_index_file(index, version, size)
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/test/test_pack.py", line 63, in _assert_index_file
    assert len(index.offsets()) == size
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/pack.py", line 413, in offsets
    a.fromstring(buffer(self._cursor.map(), self._pack_offset, self._pack_64_offset - self._pack_offset))
AttributeError: 'array.array' object has no attribute 'fromstring'

======================================================================
ERROR: test_compressed_writer (gitdb.test.test_stream.TestStream)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/test/test_stream.py", line 131, in test_compressed_writer
    data = make_bytes(ds, randomize=False)
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/test/lib.py", line 160, in make_bytes
    return a.tostring()
AttributeError: 'array.array' object has no attribute 'tostring'
-------------------- >> begin captured logging << --------------------
root: INFO: You can set the GITDB_TEST_GIT_REPO_BASE environment variable to a .git repository of your choice - defaulting to the gitdb repository
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: test_decompress_reader (gitdb.test.test_stream.TestStream)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/test/test_stream.py", line 80, in test_decompress_reader
    cdata = make_bytes(ds, randomize=False)
  File "/builddir/build/BUILD/gitdb-2.0.3/gitdb/test/lib.py", line 160, in make_bytes
    return a.tostring()
AttributeError: 'array.array' object has no attribute 'tostring'

----------------------------------------------------------------------
Ran 23 tests in 1.764s



Indeed, tostring() and fromstring() are just deprecated aliases for tobytes() and frombytes().

Deprecated since version 3.2, removed in version 3.9.

https://docs.python.org/3.8/library/array.html#array.array.tostring
https://docs.python.org/3.8/library/array.html#array.array.fromstring


For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/fedora-rawhide-x86_64/01140401-python-gitdb/

For all our attempts to build python-gitdb with Python 3.9, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/python-gitdb/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.9:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/

Let us know here if you have any questions.

Python 3.9 will be included in Fedora 33, but the initial bootstrapping has already started.
A build failure this early in the bootstrap sequence blocks us very much.

Comment 1 Lubomír Sedlář 2020-01-08 09:10:29 UTC
I submitted a patch upstream:
https://github.com/gitpython-developers/gitdb/pull/53
I also made a new build in Rawhide with this patch as python-gitdb-2.0.3-10.fc32

Comment 2 Miro Hrončok 2020-01-08 10:11:51 UTC
Confirmed. Thanks for the quick fix!


Note You need to log in before you can comment on or make changes to this bug.