[go: up one dir, main page]

Menu

#509 regression with docutils 0.22: unsupported operand type(s) for +: 'NoneType' and 'list'

closed-fixed
nobody
None
5
2025-09-18
2025-08-06
No

Hello,

after upgrading to docutils 0.22, building documentation for the pmbootstrap project fails:

    Traceback (most recent call last):
      File "/usr/lib/python3.12/site-packages/sphinx/cmd/build.py", line 432, in build_main
        app.build(args.force_all, args.filenames)
      File "/usr/lib/python3.12/site-packages/sphinx/application.py", line 426, in build
        self.builder.build_update()
      File "/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 375, in build_update
        self.build(
      File "/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 403, in build
        updated_docnames = set(self.read())
                               ^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 519, in read
        self._read_serial(docnames)
      File "/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 584, in _read_serial
        self.read_doc(docname)
      File "/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 648, in read_doc
        publisher.publish()
      File "/usr/lib/python3.12/site-packages/docutils/core.py", line 269, in publish
        self.document = self.reader.read(self.source, self.parser,
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/sphinx/io.py", line 103, in read
        self.parse()
      File "/usr/lib/python3.12/site-packages/docutils/readers/__init__.py", line 101, in parse
        self.parser.parse(self.input, document)
      File "/usr/lib/python3.12/site-packages/sphinx/parsers.py", line 86, in parse
        self.statemachine.run(inputlines, document, inliner=self.inliner)
      File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 165, in run
        results = StateMachineWS.run(self, input_lines, input_offset,
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/docutils/statemachine.py", line 235, in run
        context, next_state, result = self.check_line(
                                      ^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/docutils/statemachine.py", line 447, in check_line
        return method(match, context, next_state)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2354, in explicit_markup
        nodelist, blank_finish = self.explicit_construct(match)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2366, in explicit_construct
        return method(self, expmatch)
               ^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2103, in directive
        return self.run_directive(
               ^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2153, in run_directive
        result = directive_instance.run()
                 ^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/sphinxcontrib/autoprogram.py", line 262, in run
        nested_parse_with_titles(self.state, result, node)
      File "/usr/lib/python3.12/site-packages/sphinx/util/nodes.py", line 378, in nested_parse_with_titles
        ret = state.nested_parse(content, content_offset, node, match_titles=True)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 275, in nested_parse
        state_machine.run(block, input_offset, memo=self.memo,
      File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 191, in run
        results = StateMachineWS.run(self, input_lines, input_offset)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/docutils/statemachine.py", line 235, in run
        context, next_state, result = self.check_line(
                                      ^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/docutils/statemachine.py", line 447, in check_line
        return method(match, context, next_state)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2787, in underline
        self.section(title, source, style, lineno - 1, messages)
      File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 321, in section
        self.new_subsection(title, lineno, messages)
      File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 370, in new_subsection
        self.parent += section_node
      File "/usr/lib/python3.12/site-packages/docutils/nodes.py", line 736, in __radd__
        return other + self.children
               ~~~~~~^~~~~~~~~~~~~~~
    TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'

Source code:
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/

Tested with commit:
5927ff70b8d2468d5d0e2c978bc1fe30d036fd7f

Distribution:
Alpine Linux Edge

Related

Bugs: #508
Bugs: #510
Bugs: #511

Discussion

  • Günter Milde

    Günter Milde - 2025-08-07

    This looks like the problem reported in [bugs:#508].

    Could you check the Sphinx log?
    Do you use "autodoc" or similar extensions to extract docstrings?

     

    Related

    Bugs: #508


    Last edit: Günter Milde 2025-08-08
  • Oliver Smith

    Oliver Smith - 2025-08-07

    Do you use "autodoc" or similar extensions to extract docstrings?

    Yes, we use "sphinx.ext.autodoc".

    Could you check the Sphinx log?

    This is the output from Sphinx:

    Running Sphinx v8.2.3
    loading translations [en]... done
    making output directory... done
    Converting `source_suffix = ['.rst', '.md']` to `source_suffix = {'.rst': 'restructuredtext', '.md': 'restructuredtext'}`.
    myst v4.0.1: MdParserConfig(commonmark_only=False, gfm_only=False, enable_extensions=set(), disable_syntax=[], all_links_external=False, links_external_new_tab=False, url_schemes=('http', 'https', 'mailto', 'ftp'), ref_domains=None, fence_as_directive=set(), number_code_blocks=[], title_to_header=False, heading_anchors=0, heading_slug_func=None, html_meta={}, footnote_sort=True, footnote_transition=True, words_per_minute=200, substitutions={}, linkify_fuzzy_links=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area', enable_checkboxes=False, suppress_warnings=[], highlight_code_blocks=True)
    [autosummary] generating autosummary for: api/modules.rst, api/pmb.aportgen.rst, api/pmb.build.rst, api/pmb.chroot.rst, api/pmb.ci.rst, api/pmb.commands.rst, api/pmb.config.rst, api/pmb.core.rst, api/pmb.export.rst, api/pmb.flasher.rst, ..., api/pmb.types.rst, chroot.rst, cross_compiling.md, debugging.rst, environment_variables.md, index.rst, installation.rst, mirrors.md, ssh-keys.rst, usage.rst
    building [mo]: targets for 0 po files that are out of date
    writing output... 
    building [html]: targets for 27 source files that are out of date
    updating environment: [new config] 27 added, 0 changed, 0 removed
    reading sources... [100%] usage
    
    Versions
    ========
    
    * Platform:         linux; (Linux-6.12.37-0-lts-x86_64-with)
    * Python version:   3.12.11 (CPython)
    * Sphinx version:   8.2.3
    * Docutils version: 0.22
    * Jinja2 version:   3.1.6
    * Pygments version: 2.19.2
    
    Last Messages
    =============
    
        mirrors
    
    
        reading sources... [ 96%]
        ssh-keys
    
    
        reading sources... [100%]
        usage
    
    Loaded Extensions
    =================
    
    * sphinx.ext.mathjax (8.2.3)
    * alabaster (1.0.0)
    * sphinxcontrib.applehelp (1.0.4)
    * sphinxcontrib.devhelp (1.0.5)
    * sphinxcontrib.htmlhelp (2.1.0)
    * sphinxcontrib.serializinghtml (1.1.9)
    * sphinxcontrib.qthelp (2.0.0)
    * myst_parser (4.0.1)
    * sphinx.ext.autodoc.preserve_defaults (8.2.3)
    * sphinx.ext.autodoc.type_comment (8.2.3)
    * sphinx.ext.autodoc.typehints (8.2.3)
    * sphinx.ext.autodoc (8.2.3)
    * sphinx.ext.autosummary (8.2.3)
    * sphinx.ext.doctest (8.2.3)
    * sphinxcontrib.autoprogram (unknown version)
    * sphinxcontrib.jquery (4.1)
    
    Traceback
    =========
    
          File "/usr/lib/python3.12/site-packages/docutils/nodes.py", line 736, in __radd__
            return other + self.children
                   ~~~~~~^~~~~~~~~~~~~~~
        TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'
    
    
    The full traceback has been saved in:
    /tmp/sphinx-err-bysgrjop.log
    
    To report this error to the developers, please open an issue at <https://github.com/sphinx-doc/sphinx/issues/>. Thanks!
    Please also report this if it was a user error, so that a better error message can be provided next time.
    

    /tmp/sphinx-err-bysgrjop.log:

    Versions
    ========
    
    * Platform:         linux; (Linux-6.12.37-0-lts-x86_64-with)
    * Python version:   3.12.11 (CPython)
    * Sphinx version:   8.2.3
    * Docutils version: 0.22
    * Jinja2 version:   3.1.6
    * Pygments version: 2.19.2
    
    Last Messages
    =============
    
        mirrors
    
    
        reading sources... [ 96%]
        ssh-keys
    
    
        reading sources... [100%]
        usage
    
    Loaded Extensions
    =================
    
    * sphinx.ext.mathjax (8.2.3)
    * alabaster (1.0.0)
    * sphinxcontrib.applehelp (1.0.4)
    * sphinxcontrib.devhelp (1.0.5)
    * sphinxcontrib.htmlhelp (2.1.0)
    * sphinxcontrib.serializinghtml (1.1.9)
    * sphinxcontrib.qthelp (2.0.0)
    * myst_parser (4.0.1)
    * sphinx.ext.autodoc.preserve_defaults (8.2.3)
    * sphinx.ext.autodoc.type_comment (8.2.3)
    * sphinx.ext.autodoc.typehints (8.2.3)
    * sphinx.ext.autodoc (8.2.3)
    * sphinx.ext.autosummary (8.2.3)
    * sphinx.ext.doctest (8.2.3)
    * sphinxcontrib.autoprogram (unknown version)
    * sphinxcontrib.jquery (4.1)
    
    Traceback
    =========
    
        Traceback (most recent call last):
          File "/usr/lib/python3.12/site-packages/sphinx/cmd/build.py", line 432, in build_main
            app.build(args.force_all, args.filenames)
          File "/usr/lib/python3.12/site-packages/sphinx/application.py", line 426, in build
            self.builder.build_update()
          File "/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 375, in build_update
            self.build(
          File "/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 403, in build
            updated_docnames = set(self.read())
                                   ^^^^^^^^^^^
          File "/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 519, in read
            self._read_serial(docnames)
          File "/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 584, in _read_serial
            self.read_doc(docname)
          File "/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 648, in read_doc
            publisher.publish()
          File "/usr/lib/python3.12/site-packages/docutils/core.py", line 269, in publish
            self.document = self.reader.read(self.source, self.parser,
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/lib/python3.12/site-packages/sphinx/io.py", line 103, in read
            self.parse()
          File "/usr/lib/python3.12/site-packages/docutils/readers/__init__.py", line 101, in parse
            self.parser.parse(self.input, document)
          File "/usr/lib/python3.12/site-packages/sphinx/parsers.py", line 86, in parse
            self.statemachine.run(inputlines, document, inliner=self.inliner)
          File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 165, in run
            results = StateMachineWS.run(self, input_lines, input_offset,
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/lib/python3.12/site-packages/docutils/statemachine.py", line 235, in run
            context, next_state, result = self.check_line(
                                          ^^^^^^^^^^^^^^^^
          File "/usr/lib/python3.12/site-packages/docutils/statemachine.py", line 447, in check_line
            return method(match, context, next_state)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2354, in explicit_markup
            nodelist, blank_finish = self.explicit_construct(match)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2366, in explicit_construct
            return method(self, expmatch)
                   ^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2103, in directive
            return self.run_directive(
                   ^^^^^^^^^^^^^^^^^^^
          File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2153, in run_directive
            result = directive_instance.run()
                     ^^^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/lib/python3.12/site-packages/sphinxcontrib/autoprogram.py", line 262, in run
            nested_parse_with_titles(self.state, result, node)
          File "/usr/lib/python3.12/site-packages/sphinx/util/nodes.py", line 378, in nested_parse_with_titles
            ret = state.nested_parse(content, content_offset, node, match_titles=True)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 275, in nested_parse
            state_machine.run(block, input_offset, memo=self.memo,
          File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 191, in run
            results = StateMachineWS.run(self, input_lines, input_offset)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/lib/python3.12/site-packages/docutils/statemachine.py", line 235, in run
            context, next_state, result = self.check_line(
                                          ^^^^^^^^^^^^^^^^
          File "/usr/lib/python3.12/site-packages/docutils/statemachine.py", line 447, in check_line
            return method(match, context, next_state)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2787, in underline
            self.section(title, source, style, lineno - 1, messages)
          File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 321, in section
            self.new_subsection(title, lineno, messages)
          File "/usr/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 370, in new_subsection
            self.parent += section_node
          File "/usr/lib/python3.12/site-packages/docutils/nodes.py", line 736, in __radd__
            return other + self.children
                   ~~~~~~^~~~~~~~~~~~~~~
        TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'
    
     
  • Günter Milde

    Günter Milde - 2025-08-11

    In this case, the problem seems to be an incompatibility with Sphinx contrib extension "autoprogram".
    Can you please try with an updated repository version of Docutils?
    Commit [r10200] should fix it.

     

    Related

    Commit: [r10200]


    Last edit: Günter Milde 2025-08-12
  • Günter Milde

    Günter Milde - 2025-09-06
    • status: open --> open-fixed
     
  • Günter Milde

    Günter Milde - 2025-09-06

    This should be fixed in [r10227]. Could you re-try?

     

    Related

    Commit: [r10227]

  • Günter Milde

    Günter Milde - 2025-09-15

    Please try with Docutils 0.22.1.rc1.

     
  • Günter Milde

    Günter Milde - 2025-09-18
    • status: open-fixed --> closed-fixed
     
  • Günter Milde

    Günter Milde - 2025-09-18

    Fixed in Docutils 0.22.1.
    Please reopen if there are still problems.
    Thank you for reporting and tests.

     

Log in to post a comment.