Skip to content

6.1 breaks sphinx-argparse-cli #11091

Description

@gaborbernat

Describe the bug

#11061 raises a hard error for missing nodes, but then #4193 workaround now does not work if the source cannot be found:

>       app.build()

test_logic.py:39: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../.tox/dev/lib/python3.10/site-packages/sphinx/testing/util.py:161: in build
    super().build(force_all, filenames)
../.tox/dev/lib/python3.10/site-packages/sphinx/application.py:347: in build
    self.builder.build_update()
../.tox/dev/lib/python3.10/site-packages/sphinx/builders/__init__.py:311: in build_update
    self.build(to_build,
../.tox/dev/lib/python3.10/site-packages/sphinx/builders/__init__.py:327: in build
    updated_docnames = set(self.read())
../.tox/dev/lib/python3.10/site-packages/sphinx/builders/__init__.py:434: in read
    self._read_serial(docnames)
../.tox/dev/lib/python3.10/site-packages/sphinx/builders/__init__.py:455: in _read_serial
    self.read_doc(docname)
../.tox/dev/lib/python3.10/site-packages/sphinx/builders/__init__.py:511: in read_doc
    publisher.publish()
../.tox/dev/lib/python3.10/site-packages/docutils/core.py:226: in publish
    self.apply_transforms()
../.tox/dev/lib/python3.10/site-packages/docutils/core.py:206: in apply_transforms
    self.document.transformer.apply_transforms()
../.tox/dev/lib/python3.10/site-packages/sphinx/transforms/__init__.py:80: in apply_transforms
    super().apply_transforms()
../.tox/dev/lib/python3.10/site-packages/docutils/transforms/__init__.py:173: in apply_transforms
    transform.apply(**kwargs)
../.tox/dev/lib/python3.10/site-packages/sphinx/transforms/__init__.py:206: in apply
    apply_source_workaround(node)
../.tox/dev/lib/python3.10/site-packages/sphinx/util/nodes.py:155: in apply_source_workaround
    node.source = get_node_source(node)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

node = <literal_block: <#text: 'basic [-h]'>>

    def get_node_source(node: Element) -> str:
        for pnode in traverse_parent(node):
            if pnode.source:
                return pnode.source
>       raise ValueError("node source not found")
E       ValueError: node source not found

../.tox/dev/lib/python3.10/site-packages/sphinx/util/nodes.py:271: ValueError

How to Reproduce

Clone and run the test suite for https://github.com/tox-dev/sphinx-argparse-cli

Environment Information

Latest.

Sphinx extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions