Skip to content

_parser.parse() causes issues if directives with side-effects are active #510

Open
@marten-de-vries

Description

@marten-de-vries

sphinx-autodoc-typehints will cause a docstring to be processed twice: once by its own _parser module, and once by sphinx.ext.autodoc. This is a problem when directives that have (non-idempotent) side-effects are used.

I ran into this while combining this extension with Sphinx-Needs. The side-effect in that case is that Sphinx-Needs extracts an identifier from the directive block, and verifies the identifier is unique across the project. That's not the case if the identifier is processed twice. As this bug is caused by an interaction of extensions I've opened an issue in the Sphinx-Needs repo as well.

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