Skip to content

Return type + docstring container directive generates error #513

@trevorbaca

Description

@trevorbaca

sphinx-autodoc-typehints generates an error and a warning when processing this function:

def foo() -> int:
    """
    Description.

    ..  container::

        More description.

    """
    return
/path/to/file:5: ERROR: Content block expected for the "container" directive; none found. [docutils]
/path/to/file:6: WARNING: Explicit markup ends without a blank line; unexpected unindent. [docutils]

The bug is triggered when these two things are true:

  • the function annotates a return type
  • the function's docstring contains a container directive

This is with sphinx-autodoc-typehints 2.5.0, but I think a version of this bug (always triggered by a container directive) has been around since at least February 2023.

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