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

autodoc: single-string __slots__ is not handled correctly #8294

Closed
mgeier opened this issue Oct 5, 2020 · 0 comments · Fixed by #8338
Closed

autodoc: single-string __slots__ is not handled correctly #8294

mgeier opened this issue Oct 5, 2020 · 0 comments · Fixed by #8338

Comments

@mgeier
Copy link
Contributor

mgeier commented Oct 5, 2020

When documenting a Python module like this (using the sphinx.ext.autodoc extension):

.. automodule:: mymodule
   :members:
   :undoc-members:

... and mymodule.py has a class with a __slots__ attribute that consists of a single string like this:

class MyClassWithSlots:

    __slots__ = 'abc'

... the generated class documentation contains each of the characters in addition to the whole string:

image

Please note that the Python docs explicitly allow a single string (and not only iterables):

This class variable can be assigned a string, iterable, or sequence of strings with variable names used by instances.

When using a tuple or a list of string, everything is fine:

Expected behavior

image

Environment info

  • Sphinx version: any version, including 3.x and master branch
@mgeier mgeier added the type:bug label Oct 5, 2020
mgeier added a commit to mgeier/sphinx that referenced this issue Oct 24, 2020
@tk0miya tk0miya added this to the 3.3.0 milestone Oct 25, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants