Bug 2021849 - python-docutils fails to build with Python 3.11: TypeError: 'NoneType' object is not subscriptable
Summary: python-docutils fails to build with Python 3.11: TypeError: 'NoneType' object...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-docutils
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2021-11-10 10:17 UTC by Tomáš Hrnčiar
Modified: 2021-11-26 13:40 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-26 13:40:48 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2021-11-10 10:17:56 UTC
python-docutils fails to build with Python 3.11.0a2.

+ /usr/bin/python3 test/alltests.py
Traceback (most recent call last):
  File "/builddir/build/BUILD/docutils-0.17.1/test/alltests.py", line 91, in <module>
    suite = suite()
            ^^^^^^^
  File "/builddir/build/BUILD/docutils-0.17.1/test/alltests.py", line 78, in suite
    suite = package_unittest.loadTestModules(DocutilsTestSupport.testroot,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/docutils-0.17.1/test/package_unittest.py", line 102, in loadTestModules
    module = import_module(mod)
             ^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/docutils-0.17.1/test/package_unittest.py", line 133, in import_module
    mod = __import__(name)
          ^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/docutils-0.17.1/test/test_parsers/test_rst/test_directives/test_tables.py", line 67, in <module>
    null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes)[0]
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/02939848-python-docutils/

For all our attempts to build python-docutils with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-docutils/

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.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Tomáš Hrnčiar 2021-11-26 12:46:41 UTC
I've reported this to upstream. https://sourceforge.net/p/docutils/bugs/436/

The actual problem is that 3.11 adds support for null characters in csv module which breaks test. 

>>> import csv
>>> from docutils.parsers.rst.directives import tables
>>> with open('utf-16.csv', 'rb') as f: csv_data = f.read()
... 
>>> csv_data = str(csv_data, 'latin1').splitlines()
>>> reader = csv.reader([tables.CSVTable.encode_for_csv(line + '\n') for line in csv_data])
>>> next(reader)

Python 3.11:

['þÿ\x00"\x00T\x00r\x00e\x00a\x00t\x00"\x00', '\x00 \x00"\x00Q\x00u\x00a\x00n\x00t\x00i\x00t\x00y\x00"\x00', '\x00 \x00"\x00D\x00e\x00s\x00c\x00r\x00i\x00p\x00t\x00i\x00o\x00n\x00"\x00']

Python 3.10:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
_csv.Error: line contains NUL

Comment 2 Miro Hrončok 2021-11-26 13:40:48 UTC
Skipped the test in https://src.fedoraproject.org/rpms/python-docutils/pull-request/12


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