Skip to content

Whitespace-only RST-like docstring directives crash help parsing #738

Open

Description

@devwez

Description

A whitespace-only RST-like directive crashes fire.docstrings.parse() instead of remaining ordinary docstring text. This can also prevent Fire from displaying help for a callable with such a docstring.

from fire import docstrings

docstrings.parse('Summary.\n\n: :')

Current result on main (Python 3.14.7, Windows):

File "fire/docstrings.py", line 718, in _rst_section
    possible_title = directive.split()[0]
IndexError: list index out of range

Expected: return a DocstringInfo whose description preserves : :. The parser documents that it should run without crashing on all strings.

The directive is a nonempty whitespace string, so if directive succeeds, but directive.split() is empty. I intend to submit a focused fix that checks for a directive token before indexing it, with regression tests for space-only and tab-only directives and ordinary RST parameter parsing.

AI disclosure: this report and proposed fix were prepared using OpenAI Codex.

Activity

  1. vaibhavrvalakunde2006-gif commented on Nov 24, 2026

    @vaibhavrvalakunde2006-gif

    Hi, I'd like to take this one. Are you already working on a PR? If I don't hear back in a couple of days I'll open one with the fix and regression tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions