Skip to content

Fix/14576 autodoc data signature - #14616

Open
itsvedantkumar wants to merge 2 commits into
sphinx-doc:masterfrom
itsvedantkumar:fix/14576-autodoc-data-signature
Open

Fix/14576 autodoc data signature#14616
itsvedantkumar wants to merge 2 commits into
sphinx-doc:masterfrom
itsvedantkumar:fix/14576-autodoc-data-signature

Conversation

@itsvedantkumar

Copy link
Copy Markdown

Purpose

Hi, the bug was that autodoc doesn't build a signature for data objects. The problem was that its internal signature list is empty for them -- and when an autodoc-process-signature event handler returns a replacement signature, the code wrote it to index 0 of that empty list and ctashed with Indexerror (the docstring then got lost & a warning was printed.)

Fix: the change basically appends the handler's signature when the list is empty & behaves exactly as before when it isn't

Proof: a regression test is also included that reproduces the IndexError without the fix and passes with it; the full autodoc test suite was run with no new failures; CHANGES.rst and AUTHORS.rst entries are included

References

Fixes #14576

AI Disclosure

Claude Fable was used to develop the patch & the test under my direction -- I have reviewed the change & understand it, per the AI policy

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

autodoc: IndexError formatting signature for callable data object with annotated class variable

1 participant