Skip to content

BUG: sphinx crashes when doctest-remote-data-all is at top of file #291

@bsipocz

Description

@bsipocz

The .. doctest-remote-data-all:: directive can be used anywhere in the file and it will skip the remaining parts unless remote-data is enabled. However when I put it at the very top of an rst file sphinx crashes.

See astropy/astropy#17839

and https://app.readthedocs.org/projects/astropy/builds/27974431/


reading sources... [ 89%] io/votable/dataorigin
Versions
========
* Platform:         linux; (Linux-6.8.0-1021-aws-x86_64-with-glibc2.35)
* Python version:   3.13.3 (CPython)
* Sphinx version:   8.2.3
* Docutils version: 0.21.2
* Jinja2 version:   3.1.6
* Pygments version: 2.19.1
Last Messages
=============
    reading sources... [ 89%]
    io/votable/api_exceptions
    reading sources... [ 89%]
    io/votable/coosys_element
    reading sources... [ 89%]
    io/votable/dataorigin
Loaded Extensions
=================
* sphinx.ext.mathjax (8.2.3)
* alabaster (1.0.0)
* sphinxcontrib.applehelp (2.0.0)
* sphinxcontrib.devhelp (2.0.0)
* sphinxcontrib.htmlhelp (2.1.0)
* sphinxcontrib.serializinghtml (1.1.10)
* sphinxcontrib.qthelp (2.0.0)
* 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.coverage (8.2.3)
* sphinx.ext.graphviz (8.2.3)
* sphinx.ext.inheritance_diagram (8.2.3)
* sphinx.ext.intersphinx (8.2.3)
* sphinx.ext.todo (8.2.3)
* sphinx.ext.viewcode (8.2.3)
* sphinxcontrib.jquery (4.1)
* sphinx.ext.autosummary (8.2.3)
* numpydoc (1.8.0)
* sphinx_copybutton (0.5.2)
* pytest_doctestplus.sphinx.doctestplus (unknown version)
* sphinx_astropy.ext.changelog_links (unknown version)
* sphinx_astropy.ext.generate_config (0.1)
* sphinx_astropy.ext.intersphinx_toggle (unknown version)
* sphinx_astropy.ext.missing_static (unknown version)
* sphinx_automodapi.autodoc_enhancements (unknown version)
* sphinx_automodapi.automodsumm (unknown version)
* sphinx_automodapi.automodapi (unknown version)
* sphinx_automodapi.smart_resolver (unknown version)
* matplotlib.sphinxext.plot_directive (3.10.1)
* matplotlib.sphinxext.roles (3.10.1)
* sphinx_changelog (unknown version)
* sphinx_design (0.6.1)
* sphinxcontrib.globalsubs (0.1.0)
* pydata_sphinx_theme (unknown version)
Traceback
=========
    Traceback (most recent call last):
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/sphinx/cmd/build.py", line 432, in build_main
        app.build(args.force_all, args.filenames)
        ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/sphinx/application.py", line 426, in build
        self.builder.build_update()
        ~~~~~~~~~~~~~~~~~~~~~~~~~^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/sphinx/builders/__init__.py", line 375, in build_update
        self.build(
        ~~~~~~~~~~^
            to_build,
            ^^^^^^^^^
        ...<2 lines>...
            method='update',
            ^^^^^^^^^^^^^^^^
        )
        ^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/sphinx/builders/__init__.py", line 403, in build
        updated_docnames = set(self.read())
                               ~~~~~~~~~^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/sphinx/builders/__init__.py", line 519, in read
        self._read_serial(docnames)
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/sphinx/builders/__init__.py", line 584, in _read_serial
        self.read_doc(docname)
        ~~~~~~~~~~~~~^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/sphinx/builders/__init__.py", line 648, in read_doc
        publisher.publish()
        ~~~~~~~~~~~~~~~~~^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/docutils/core.py", line 234, in publish
        self.document = self.reader.read(self.source, self.parser,
                        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
                                         self.settings)
                                         ^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/sphinx/io.py", line 103, in read
        self.parse()
        ~~~~~~~~~~^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/docutils/readers/__init__.py", line 76, in parse
        self.parser.parse(self.input, document)
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/sphinx/parsers.py", line 86, in parse
        self.statemachine.run(inputlines, document, inliner=self.inliner)
        ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/docutils/parsers/rst/states.py", line 169, in run
        results = StateMachineWS.run(self, input_lines, input_offset,
                                     input_source=document['source'])
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/docutils/statemachine.py", line 233, in run
        context, next_state, result = self.check_line(
                                      ~~~~~~~~~~~~~~~^
            context, state, transitions)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/docutils/statemachine.py", line 445, in check_line
        return method(match, context, next_state)
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/docutils/parsers/rst/states.py", line 2357, in explicit_markup
        nodelist, blank_finish = self.explicit_construct(match)
                                 ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/docutils/parsers/rst/states.py", line 2369, in explicit_construct
        return method(self, expmatch)
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/docutils/parsers/rst/states.py", line 2106, in directive
        return self.run_directive(
               ~~~~~~~~~~~~~~~~~~^
            directive_class, match, type_name, option_presets)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/docutils/parsers/rst/states.py", line 2156, in run_directive
        result = directive_instance.run()
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/pytest_doctestplus/sphinx/doctestplus.py", line 23, in run
        if re.match('win32', self.content[0]):
                             ~~~~~~~~~~~~^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17839/lib/python3.13/site-packages/docutils/statemachine.py", line 1136, in __getitem__
        return self.data[i]
               ~~~~~~~~~^^^
    IndexError: list index out of range
The full traceback has been saved in:
/tmp/sphinx-err-rcq50vmx.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions