Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.2.0 parses dataclasses.field(..., kw_only) incorrectly #13410

Open
trevorbaca opened this issue Mar 4, 2025 · 4 comments
Open

8.2.0 parses dataclasses.field(..., kw_only) incorrectly #13410

trevorbaca opened this issue Mar 4, 2025 · 4 comments
Labels

Comments

@trevorbaca
Copy link

trevorbaca commented Mar 4, 2025

Describe the bug

This works in Sphinx up to (and including) 8.1.3:

@dataclasses.dataclass(frozen=True, order=True, slots=True, unsafe_hash=True)
class Feather:
    items: list
    denominator: int
    numerator: int
    exponent: float = dataclasses.field(default=0.625, kw_only=True)

But this same code now causes Sphinx 8.2.0 autosummary to complain:

...foo.rst:43:<autosummary>:1: WARNING: Inline emphasis start-string without end-string. [docutils]

8.2.0 is happy when kw_only=True is removed; ie, this generates no warnings under 8.2.0:

@dataclasses.dataclass(frozen=True, order=True, slots=True, unsafe_hash=True)
class Feather:
    items: list
    denominator: int
    numerator: int
    exponent: float = dataclasses.field(default=0.625)

Presumably something changed from 8.1.3 to 8.2.0 in the way that autosummary parses dataclass signatures.

Tested under 8.2.0, 8.2.1, 8.2.2 and 8.2.3: all four releases generate the same warning.

How to Reproduce

Run autosummary on this under 8.2.0, 8.2.1, 8.2.2 or 8.2.3:

@dataclasses.dataclass(frozen=True, order=True, slots=True, unsafe_hash=True)
class Feather:
    items: list
    denominator: int
    numerator: int
    exponent: float = dataclasses.field(default=0.625, kw_only=True)

The following warning will appear:

...foo.rst:43:<autosummary>:1: WARNING: Inline emphasis start-string without end-string. [docutils]

The warning did not appear under 8.1.3 (and earlier).

Environment Information

Platform:              darwin; (macOS-15.3.1-arm64-arm-64bit-Mach-O)
Python version:        3.13.2 (v3.13.2:4f8bb3947cf, Feb  4 2025, 11:51:10) [Clang 15.0.0 (clang-1500.3.9.4)])
Python implementation: CPython
Sphinx version:        8.2.3
Docutils version:      0.21.2
Jinja2 version:        3.1.5
Pygments version:      2.19.1

Sphinx extensions

Additional context

No response

@AA-Turner
Copy link
Member

AA-Turner commented Mar 6, 2025

@trevorbaca can you provide your index.rst please?

For reference, I don't have any errors with the following reproduction script:

import shutil
from pathlib import Path

from sphinx.cmd.make_mode import run_make_mode

def write(p: Path, text: str) -> None:
    p.write_text(text, encoding='utf-8')

write(Path('conf.py'), """\
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
]
nitpicky = True
""")

write(Path('bug.py'), """\
import dataclasses

@dataclasses.dataclass(frozen=True, order=True, slots=True, unsafe_hash=True)
class Feather:
    denominator: int
    numerator: int
    exponent: float = dataclasses.field(default=0.625, kw_only=True)
""")

write(Path('index.rst'), """\
GH-13410
========

.. autosummary::

   bug.Feather

.. automodule:: bug
   :members:

""")

shutil.rmtree('_build', ignore_errors=True)
run_make_mode(['html', '.', '_build', '--show-traceback', '--fail-on-warning'])

@trevorbaca
Copy link
Author

trevorbaca commented Mar 6, 2025

Hi @AA-Turner here's the rhythm.rst that Sphinx generates; the warning is given for line 43 in this file. This is the first line of whitespace following the preceding autosummary block that contains the Feather class with the offending kw_only keyword:

BEGIN rhythm.rst

.. _baca--rhythm:

rhythm
======

.. automodule:: baca.rhythm

.. currentmodule:: baca.rhythm

.. container:: svg-container

   .. inheritance-diagram:: baca
      :lineage: baca.rhythm

.. raw:: html

   <hr/>

.. rubric:: Classes
   :class: section-header

.. autosummary::
   :nosignatures:

   ~AfterGrace
   ~BeamLeft
   ~BeamRight
   ~BeforeGrace
   ~Chord
   ~Container
   ~Feather
   ~FramedNote
   ~IndependentAfterGrace
   ~InvisibleMusic
   ~LMR
   ~Multiplier
   ~OBGC
   ~RepeatTie
   ~Tie
   ~TremoloContainer
   ~Tuplet
   ~WrittenDuration

.. autoclass:: AfterGrace

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __call__
      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __post_init__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: AfterGrace.__call__

   .. automethod:: AfterGrace.__delattr__

   .. automethod:: AfterGrace.__eq__

   .. automethod:: AfterGrace.__ge__

   .. automethod:: AfterGrace.__gt__

   .. automethod:: AfterGrace.__hash__

   .. automethod:: AfterGrace.__le__

   .. automethod:: AfterGrace.__lt__

   .. automethod:: AfterGrace.__post_init__

   .. automethod:: AfterGrace.__replace__

   .. automethod:: AfterGrace.__repr__

   .. automethod:: AfterGrace.__setattr__

.. autoclass:: BeamLeft

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: BeamLeft.__delattr__

   .. automethod:: BeamLeft.__eq__

   .. automethod:: BeamLeft.__ge__

   .. automethod:: BeamLeft.__gt__

   .. automethod:: BeamLeft.__hash__

   .. automethod:: BeamLeft.__le__

   .. automethod:: BeamLeft.__lt__

   .. automethod:: BeamLeft.__replace__

   .. automethod:: BeamLeft.__repr__

   .. automethod:: BeamLeft.__setattr__

.. autoclass:: BeamRight

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: BeamRight.__delattr__

   .. automethod:: BeamRight.__eq__

   .. automethod:: BeamRight.__ge__

   .. automethod:: BeamRight.__gt__

   .. automethod:: BeamRight.__hash__

   .. automethod:: BeamRight.__le__

   .. automethod:: BeamRight.__lt__

   .. automethod:: BeamRight.__replace__

   .. automethod:: BeamRight.__repr__

   .. automethod:: BeamRight.__setattr__

.. autoclass:: BeforeGrace

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __call__
      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __post_init__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: BeforeGrace.__call__

   .. automethod:: BeforeGrace.__delattr__

   .. automethod:: BeforeGrace.__eq__

   .. automethod:: BeforeGrace.__ge__

   .. automethod:: BeforeGrace.__gt__

   .. automethod:: BeforeGrace.__hash__

   .. automethod:: BeforeGrace.__le__

   .. automethod:: BeforeGrace.__lt__

   .. automethod:: BeforeGrace.__post_init__

   .. automethod:: BeforeGrace.__replace__

   .. automethod:: BeforeGrace.__repr__

   .. automethod:: BeforeGrace.__setattr__

.. autoclass:: Chord

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __post_init__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: Chord.__delattr__

   .. automethod:: Chord.__eq__

   .. automethod:: Chord.__ge__

   .. automethod:: Chord.__gt__

   .. automethod:: Chord.__hash__

   .. automethod:: Chord.__le__

   .. automethod:: Chord.__lt__

   .. automethod:: Chord.__post_init__

   .. automethod:: Chord.__replace__

   .. automethod:: Chord.__repr__

   .. automethod:: Chord.__setattr__

.. autoclass:: Container

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __call__
      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: Container.__call__

   .. automethod:: Container.__delattr__

   .. automethod:: Container.__eq__

   .. automethod:: Container.__ge__

   .. automethod:: Container.__gt__

   .. automethod:: Container.__hash__

   .. automethod:: Container.__le__

   .. automethod:: Container.__lt__

   .. automethod:: Container.__replace__

   .. automethod:: Container.__repr__

   .. automethod:: Container.__setattr__

.. autoclass:: Feather

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __call__
      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __post_init__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: Feather.__call__

   .. automethod:: Feather.__delattr__

   .. automethod:: Feather.__eq__

   .. automethod:: Feather.__ge__

   .. automethod:: Feather.__gt__

   .. automethod:: Feather.__hash__

   .. automethod:: Feather.__le__

   .. automethod:: Feather.__lt__

   .. automethod:: Feather.__post_init__

   .. automethod:: Feather.__replace__

   .. automethod:: Feather.__repr__

   .. automethod:: Feather.__setattr__

.. autoclass:: FramedNote

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: FramedNote.__delattr__

   .. automethod:: FramedNote.__eq__

   .. automethod:: FramedNote.__ge__

   .. automethod:: FramedNote.__gt__

   .. automethod:: FramedNote.__hash__

   .. automethod:: FramedNote.__le__

   .. automethod:: FramedNote.__lt__

   .. automethod:: FramedNote.__replace__

   .. automethod:: FramedNote.__repr__

   .. automethod:: FramedNote.__setattr__

.. autoclass:: IndependentAfterGrace

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __call__
      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __post_init__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: IndependentAfterGrace.__call__

   .. automethod:: IndependentAfterGrace.__delattr__

   .. automethod:: IndependentAfterGrace.__eq__

   .. automethod:: IndependentAfterGrace.__ge__

   .. automethod:: IndependentAfterGrace.__gt__

   .. automethod:: IndependentAfterGrace.__hash__

   .. automethod:: IndependentAfterGrace.__le__

   .. automethod:: IndependentAfterGrace.__lt__

   .. automethod:: IndependentAfterGrace.__post_init__

   .. automethod:: IndependentAfterGrace.__replace__

   .. automethod:: IndependentAfterGrace.__repr__

   .. automethod:: IndependentAfterGrace.__setattr__

.. autoclass:: InvisibleMusic

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: InvisibleMusic.__delattr__

   .. automethod:: InvisibleMusic.__eq__

   .. automethod:: InvisibleMusic.__ge__

   .. automethod:: InvisibleMusic.__gt__

   .. automethod:: InvisibleMusic.__hash__

   .. automethod:: InvisibleMusic.__le__

   .. automethod:: InvisibleMusic.__lt__

   .. automethod:: InvisibleMusic.__replace__

   .. automethod:: InvisibleMusic.__repr__

   .. automethod:: InvisibleMusic.__setattr__

.. autoclass:: LMR

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __call__
      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __post_init__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: LMR.__call__

   .. automethod:: LMR.__delattr__

   .. automethod:: LMR.__eq__

   .. automethod:: LMR.__ge__

   .. automethod:: LMR.__gt__

   .. automethod:: LMR.__hash__

   .. automethod:: LMR.__le__

   .. automethod:: LMR.__lt__

   .. automethod:: LMR.__post_init__

   .. automethod:: LMR.__replace__

   .. automethod:: LMR.__repr__

   .. automethod:: LMR.__setattr__

.. autoclass:: Multiplier

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __call__
      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __post_init__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: Multiplier.__call__

   .. automethod:: Multiplier.__delattr__

   .. automethod:: Multiplier.__eq__

   .. automethod:: Multiplier.__ge__

   .. automethod:: Multiplier.__gt__

   .. automethod:: Multiplier.__hash__

   .. automethod:: Multiplier.__le__

   .. automethod:: Multiplier.__lt__

   .. automethod:: Multiplier.__post_init__

   .. automethod:: Multiplier.__replace__

   .. automethod:: Multiplier.__repr__

   .. automethod:: Multiplier.__setattr__

.. autoclass:: OBGC

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __call__
      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __post_init__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: OBGC.__call__

   .. automethod:: OBGC.__delattr__

   .. automethod:: OBGC.__eq__

   .. automethod:: OBGC.__ge__

   .. automethod:: OBGC.__gt__

   .. automethod:: OBGC.__hash__

   .. automethod:: OBGC.__le__

   .. automethod:: OBGC.__lt__

   .. automethod:: OBGC.__post_init__

   .. automethod:: OBGC.__replace__

   .. automethod:: OBGC.__repr__

   .. automethod:: OBGC.__setattr__

.. autoclass:: RepeatTie

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: RepeatTie.__delattr__

   .. automethod:: RepeatTie.__eq__

   .. automethod:: RepeatTie.__ge__

   .. automethod:: RepeatTie.__gt__

   .. automethod:: RepeatTie.__hash__

   .. automethod:: RepeatTie.__le__

   .. automethod:: RepeatTie.__lt__

   .. automethod:: RepeatTie.__replace__

   .. automethod:: RepeatTie.__repr__

   .. automethod:: RepeatTie.__setattr__

.. autoclass:: Tie

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: Tie.__delattr__

   .. automethod:: Tie.__eq__

   .. automethod:: Tie.__ge__

   .. automethod:: Tie.__gt__

   .. automethod:: Tie.__hash__

   .. automethod:: Tie.__le__

   .. automethod:: Tie.__lt__

   .. automethod:: Tie.__replace__

   .. automethod:: Tie.__repr__

   .. automethod:: Tie.__setattr__

.. autoclass:: TremoloContainer

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __call__
      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __post_init__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: TremoloContainer.__call__

   .. automethod:: TremoloContainer.__delattr__

   .. automethod:: TremoloContainer.__eq__

   .. automethod:: TremoloContainer.__ge__

   .. automethod:: TremoloContainer.__gt__

   .. automethod:: TremoloContainer.__hash__

   .. automethod:: TremoloContainer.__le__

   .. automethod:: TremoloContainer.__lt__

   .. automethod:: TremoloContainer.__post_init__

   .. automethod:: TremoloContainer.__replace__

   .. automethod:: TremoloContainer.__repr__

   .. automethod:: TremoloContainer.__setattr__

.. autoclass:: Tuplet

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __call__
      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __post_init__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: Tuplet.__call__

   .. automethod:: Tuplet.__delattr__

   .. automethod:: Tuplet.__eq__

   .. automethod:: Tuplet.__ge__

   .. automethod:: Tuplet.__gt__

   .. automethod:: Tuplet.__hash__

   .. automethod:: Tuplet.__le__

   .. automethod:: Tuplet.__lt__

   .. automethod:: Tuplet.__post_init__

   .. automethod:: Tuplet.__replace__

   .. automethod:: Tuplet.__repr__

   .. automethod:: Tuplet.__setattr__

.. autoclass:: WrittenDuration

   .. raw:: html

      <hr/>

   .. rubric:: Attributes Summary
      :class: class-header

   .. autosummary::
      :nosignatures:

      __call__
      __delattr__
      __eq__
      __ge__
      __gt__
      __hash__
      __le__
      __lt__
      __post_init__
      __replace__
      __repr__
      __setattr__

   .. raw:: html

      <hr/>

   .. rubric:: Special methods
      :class: class-header

   .. automethod:: WrittenDuration.__call__

   .. automethod:: WrittenDuration.__delattr__

   .. automethod:: WrittenDuration.__eq__

   .. automethod:: WrittenDuration.__ge__

   .. automethod:: WrittenDuration.__gt__

   .. automethod:: WrittenDuration.__hash__

   .. automethod:: WrittenDuration.__le__

   .. automethod:: WrittenDuration.__lt__

   .. automethod:: WrittenDuration.__post_init__

   .. automethod:: WrittenDuration.__replace__

   .. automethod:: WrittenDuration.__repr__

   .. automethod:: WrittenDuration.__setattr__

.. raw:: html

   <hr/>

.. rubric:: Functions
   :class: section-header

.. autosummary::
   :nosignatures:

   ~A
   ~AG
   ~BG
   ~C
   ~IAG
   ~R
   ~T
   ~TC
   ~attach_bgcs
   ~bl
   ~br
   ~c
   ~from_collection
   ~get_previous_rhythm_state
   ~h
   ~m
   ~make_accelerando
   ~make_bgcs
   ~make_even_divisions
   ~make_mmrests
   ~make_monads
   ~make_notes
   ~make_repeat_tied_notes
   ~make_repeated_duration_notes
   ~make_rests
   ~make_rhythm
   ~make_single_attack
   ~make_tied_notes
   ~make_tied_repeated_durations
   ~make_time_signatures
   ~nest
   ~prolate
   ~replace_nontrivial_skip_filled_tuplets
   ~rt
   ~style_accelerando
   ~style_ritardando
   ~t
   ~w

.. autofunction:: A

.. autofunction:: AG

.. autofunction:: BG

.. autofunction:: C

.. autofunction:: IAG

.. autofunction:: R

.. autofunction:: T

.. autofunction:: TC

.. autofunction:: attach_bgcs

.. autofunction:: bl

.. autofunction:: br

.. autofunction:: c

.. autofunction:: from_collection

.. autofunction:: get_previous_rhythm_state

.. autofunction:: h

.. autofunction:: m

.. autofunction:: make_accelerando

.. autofunction:: make_bgcs

.. autofunction:: make_even_divisions

.. autofunction:: make_mmrests

.. autofunction:: make_monads

.. autofunction:: make_notes

.. autofunction:: make_repeat_tied_notes

.. autofunction:: make_repeated_duration_notes

.. autofunction:: make_rests

.. autofunction:: make_rhythm

.. autofunction:: make_single_attack

.. autofunction:: make_tied_notes

.. autofunction:: make_tied_repeated_durations

.. autofunction:: make_time_signatures

.. autofunction:: nest

.. autofunction:: prolate

.. autofunction:: replace_nontrivial_skip_filled_tuplets

.. autofunction:: rt

.. autofunction:: style_accelerando

.. autofunction:: style_ritardando

.. autofunction:: t

.. autofunction:: w

END rhythm.rst

@trevorbaca
Copy link
Author

Hi again @AA-Turner if it helps narrow things down, I'm pretty sure that what's happening is that something like *args or **kwargs is being generated for the __init__ method of a dataclass, and that the single asterisk (or double asterisk) in the signature is being interpreted as reST start-emphasis (that then goes "unmatched" with closing asterisk).

In addition to the example at the start of this thread, there are two other places in my codebase where 8.2.x generates this same "Inline emphasis start-string ..." warning. And they are here, which are the only two dataclasses in my codebase that use *arguments in their initializer:

@dataclasses.dataclass(order=True, slots=True, unsafe_hash=True)
class Breaks:

pages: list["Page"] = dataclasses.field(default_factory=list)

def __init__(self, *arguments: "Page"):
    for page_number, argument in enumerate(arguments, start=1):
        assert isinstance(argument, Page), repr(argument)
        if argument.number != page_number:
            message = f"page number ({argument.number}) is not {page_number}"
            raise Exception(message)
    self.pages = list(arguments)

@dataclasses.dataclass(order=True, slots=True, unsafe_hash=True)
class Page:

number: int
systems: list["System"] = dataclasses.field(default_factory=list)

def __init__(self, number: int, *systems):
    assert isinstance(number, int), repr(number)
    self.number = number
    assert all(isinstance(_, System) for _ in systems), repr(systems)
    self.systems = list(systems)

@AA-Turner
Copy link
Member

Altering my index.rst from the reproducer script to the below, I still don't get an error. Can you provide a minimal rST source that triggers the warning?

GH-13410
========

.. automodule:: bug
   :members:

.. currentmodule:: bug

.. rubric:: Classes
   :class: section-header

.. autosummary::
   :nosignatures:

   ~Feather

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants