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

TypeError: can't set attributes of built-in/extension type 'list' #7821

Closed
NucleaPeon opened this issue Jun 11, 2020 · 3 comments
Closed

TypeError: can't set attributes of built-in/extension type 'list' #7821

NucleaPeon opened this issue Jun 11, 2020 · 3 comments

Comments

@NucleaPeon
Copy link

Previous issue: #7791

Describe the bug
Running sphinx-build after sphinx-apidoc on our codebase results in the error message:

  File "/home/danielk/.local/lib/python3.7/site-packages/sphinx/ext/autodoc/__init__.py", line 1240, in annotate_to_first_argument
    func.__signature__ = sig.replace(parameters=params)  # type: ignore
TypeError: can't set attributes of built-in/extension type 'list'

To Reproduce
Steps to reproduce the behavior:

Run make html in project folder

Expected behavior
No error

Your project

n/a

Screenshots
If applicable, add screenshots to help explain your problem.

Environment info

  • OS: Gentoo Linux, KDE 19.12.3, Plasma 5.70
  • Python version: 3.7.7
  • Sphinx version: See below
  • Sphinx extensions: See below
  • Extra tools: n/a
alabaster                          0.7.12            
autodoc                            0.5.0             
Babel                              2.8.0             
beautifulsoup4                     4.9.1             
Brotli                             1.0.7             
bsddb3                             6.2.7             
certifi                            2020.4.5.1        
cffi                               1.14.0            
chardet                            3.0.4             
cracklib                           2.9.7             
cryptacular                        1.4.1             /home/danielk/Development/cryptacular/src/cryptacular
cryptography                       2.8               
Cython                             0.29.15           
decorator                          4.4.2             
distro                             1.0.4             
docutils                           0.16              
extras                             1.0.0             
file-magic                         0.4.0             
fixtures                           3.0.0             
FormEncode                         1.3.1             
gdbus-codegen                      2.62.6            
gemato                             14.3              
gentoolkit                         0.4.8             
gpg                                1.13.0            
gpodder                            3.10.5            
html5lib                           1.0.1             
idna                               2.8               
imagesize                          1.1.0             
isodate                            0.6.0             
isort                              4.3.15            
java-config                        2.2.0             
Jinja2                             2.11.1            
layman                             2.4.3             
lensfun                            0.3.2             
libsass                            0.20.0            
linecache2                         1.0.0             
lxml                               4.5.0             
M2Crypto                           0.31.0            
Mako                               1.1.2             
Markdown                           2.4.1             
Markups                            3.0.0             
MarkupSafe                         1.1.1             
mercurial                          5.3.2             
meson                              0.52.1            
mimeparse                          1.6.0             
mock                               4.0.2             
Momoko                             2.2.5.1           
mygpoclient                        1.8               
netlink                            1.0               
notify2                            0.3.1             
numpy                              1.17.4            
olefile                            0.46              
packaging                          20.3              
pbkdf2                             1.3               
pbr                                5.1.1             
pdoc                               0.3.2             
Pillow                             7.0.0             
pip                                20.0.2            
ply                                3.11              
podcastparser                      0.6.4             
portage                            2.3.99            
psycopg2                           2.8.5             
psycopg2-binary                    2.8.5             
pwquality                          1.4.2             
pycairo                            1.18.2            
Pycco                              0.6.0             
pycountry                          19.8.18           
pycparser                          2.20              
pycryptodome                       3.9.4             
pyelftools                         0.25              
pyenchant                          2.0.0             
Pygments                           2.5.2             
PyGObject                          3.34.0            
pyOpenSSL                          19.1.0            
pyparsing                          2.4.6             
pyportmidi                         0.0.7             
PyQt5                              5.14.1            
PyQt5-sip                          4.19.21           
PyQtWebEngine                      5.14.0            
pyrsistent                         0.15.6            
PySocks                            1.7.1             
pystache                           0.5.4             
python-markdown-math               0.6               
python-mimeparse                   1.6.0             
python-subunit                     1.2.0             
pytz                               2019.3            
pyxdg                              0.26              
PyYAML                             5.3.1             
rdflib                             4.2.2             
reportlab                          3.5.13            
requests                           2.23.0            
ReText                             7.0.4             
scour                              0.37              
setuptools                         44.1.0            
simplejson                         3.17.0            
sip                                4.19.21           
six                                1.14.0            
smartypants                        2.0.1             
snowballstemmer                    2.0.0             
soupsieve                          2.0.1             
Sphinx                             3.1.0             
sphinx-rtd-theme                   0.4.3             
sphinx-rtd-theme-http              1.0.0             
sphinxcontrib-apidoc               0.3.0             
sphinxcontrib-applehelp            1.0.2             
sphinxcontrib-autodoc-doxygen      0.6.0             
sphinxcontrib-autodoc-filterparams 0.0.1             
sphinxcontrib-devhelp              1.0.2             
sphinxcontrib-htmlhelp             1.0.3             
sphinxcontrib-httpdomain           1.7.0             
sphinxcontrib-jsmath               1.0.1             
sphinxcontrib-mockautodoc          0.0.1.dev20130518 
sphinxcontrib-qthelp               1.0.3             
sphinxcontrib-serializinghtml      1.1.3             
ssl-fetch                          0.4               
testtools                          2.3.0             
tornado                            5.1.1             
traceback2                         1.4.0             
typed-ast                          1.4.1             
unittest2                          1.1.0             
urllib3                            1.25.8            
waitress                           1.4.4             
webencodings                       0.5.1             
WebOb                              1.8.6             
WebTest                            2.0.35            
youtube-dl                         2020.5.29         
zstandard                          0.13.0 

Additional context


Running Sphinx v3.1.0
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 41 source files that are out of date
updating environment: [new config] 41 added, 0 changed, 0 removed
reading sources... [ 87%] ... Exception occurred:
  File "/home/danielk/.local/lib/python3.7/site-packages/sphinx/ext/autodoc/__init__.py", line 1240, in annotate_to_first_argument
    func.__signature__ = sig.replace(parameters=params)  # type: ignore
TypeError: can't set attributes of built-in/extension type 'list'
The full traceback has been saved in /tmp/sphinx-err-lf0wsvvp.log

, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
make[1]: *** [Makefile:20: html] Error 2
make[1]: Leaving directory '/home/danielk/Development/docs'
make: *** [Makefile:85: docs] Error 2

sphinx-err-lf0wsvvp.log

@NucleaPeon
Copy link
Author

Offending code that seems to cause the error when included.

import collections
import argparse


class Namespace(argparse.Namespace):

    @property
    def vs(self):
        return vars(self)


def make_default_ns_dict_class(namespace=Namespace):
    class DefaultNamespaceDict(collections.defaultdict):
        def __init__(self, *args, **kwargs):
            super().__init__(namespace, *args, **kwargs)
    return DefaultNamespaceDict


NS = Namespace
NamespaceDict = make_default_ns_dict_class()

@tk0miya
Copy link
Member

tk0miya commented Jun 12, 2020

I can't reproduce the error on my local. But I think #7823 will resolve your error. Could you try this please?

tk0miya added a commit that referenced this issue Jun 14, 2020
Fix #7821: autodoc: TypeError is raised for overloaded C-ext function
@tk0miya
Copy link
Member

tk0miya commented Jun 14, 2020

I merged #7823 and going to release it as 3.1.1. Please check this in new package.
Thanks,

@tk0miya tk0miya closed this as completed Jun 14, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 23, 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