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

New autodoc_class_signature config option gives an exception #9471

Closed
miohtama opened this issue Jul 19, 2021 · 0 comments
Closed

New autodoc_class_signature config option gives an exception #9471

miohtama opened this issue Jul 19, 2021 · 0 comments

Comments

@miohtama
Copy link

Describe the bug

The option causes an exception on build when used as documented

How to Reproduce

When setting autodoc_class_signature = "separated" in conf.py

I get:

Exception occurred:
  File "/Users/moo/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/sphinx/ext/autodoc/__init__.py", line 1452, in __init__
    self.options.special_members.append('__new__')
AttributeError: 'set' object has no attribute 'append'

Expected behavior

The signature setting works or explains if there is something wrong with the configuration file.

Your project

https://github.com/miohtama/capitalgram-onchain-dex-quant-data/blob/master/docs/source/conf.py

Screenshots

No response

OS

Mac

Python version

3.0

Sphinx version

4.1.1

Sphinx extensions

sphinx.ext.autodoc

Extra tools

No response

Additional context

Probably this bit is faulty - cannot decide if the option is set or list

    def __init__(self, *args: Any) -> None:
        super().__init__(*args)

        if self.config.autodoc_class_signature == 'separated':
            # show __init__() method
            if self.options.special_members is None:
                self.options['special-members'] = {'__new__', '__init__'}
            else:
                self.options.special_members.append('__new__')
                self.options.special_members.append('__init__')

        merge_members_option(self.options)
@tk0miya tk0miya added this to the 4.1.2 milestone Jul 24, 2021
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jul 24, 2021
…ss_signature = "separated"

A list should be used for special-members option instead of set.
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jul 24, 2021
…ss_signature = "separated"

A list should be used for special-members option instead of set.
tk0miya added a commit that referenced this issue Jul 25, 2021
Fix #9436, #9471: autodoc: crashed if autodoc_class_signature = "separated"
@tk0miya tk0miya closed this as completed Jul 25, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants