Skip to content

Bad display of annotated enum members #14653

Open

Description

@azmeuk

Describe the bug

When a type is in the form of an annotated enum member such as Annotated[int, Color.red], the type display is broken.

How to Reproduce

example.py

from enum import Enum
from typing import Annotated


class Color(Enum):
    red = 'red'


def function(arg: Annotated[int, Color.red]) -> None:
    """docstring"""


class Class:
    """docstring"""

    #: docstring
    attribute: Annotated[int, Color.red]

conf.py

import os
import sys

sys.path.insert(0, os.path.abspath('.'))
extensions = ['sphinx.ext.autodoc']

index.rst

.. automodule:: example
   :members:
$ sphinx-build -M html . _build

This produces:

Image

Environment Information

Platform:              linux; (Linux-7.1.8-arch1-3-x86_64-with-glibc2.44)
Python version:        3.14.3 (main, Mar 24 2026, 22:50:36) [Clang 22.1.1 ])
Python implementation: CPython
Sphinx version:        9.1.0
Docutils version:      0.22.4
Jinja2 version:        3.1.6
Pygments version:      2.21.0

Sphinx extensions

['sphinx.ext.autodoc']

Additional context

No response

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions