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

AttributeError: 'getset_descriptor' object has no attribute 'expandtabs' #7451

Closed
laloch opened this issue Apr 9, 2020 · 2 comments
Closed

Comments

@laloch
Copy link

laloch commented Apr 9, 2020

I'm getting the following backtrace while trying to build http://github.com/xonsh/xonsh documentation:

# Sphinx version: 3.0.0
# Python version: 3.8.2 (CPython)
# Docutils version: 0.16 release
# Jinja2 version: 2.11.1
# Last messages:
#   reading sources... [ 20%] api/execer
#   reading sources... [ 21%] api/foreign_shells
#   reading sources... [ 22%] api/history/base
#   reading sources... [ 22%] api/history/index
#   reading sources... [ 23%] api/history/json
#   reading sources... [ 24%] api/history/main
#   reading sources... [ 25%] api/history/sqlite
#   reading sources... [ 25%] api/imphooks
#   reading sources... [ 26%] api/index
#   reading sources... [ 27%] api/inspectors
# Loaded extensions:
#   sphinx.ext.mathjax (3.0.0) from /usr/local/lib/python3.8/site-packages/sphinx/ext/mathjax.py
#   sphinxcontrib.applehelp (1.0.2) from /usr/local/lib/python3.8/site-packages/sphinxcontrib/applehelp/__init__.py
#   sphinxcontrib.devhelp (1.0.2) from /usr/local/lib/python3.8/site-packages/sphinxcontrib/devhelp/__init__.py
#   sphinxcontrib.htmlhelp (1.0.3) from /usr/local/lib/python3.8/site-packages/sphinxcontrib/htmlhelp/__init__.py
#   sphinxcontrib.serializinghtml (1.1.4) from /usr/local/lib/python3.8/site-packages/sphinxcontrib/serializinghtml/__init__.py
#   sphinxcontrib.qthelp (1.0.3) from /usr/local/lib/python3.8/site-packages/sphinxcontrib/qthelp/__init__.py
#   alabaster (0.7.12) from /usr/local/lib/python3.8/site-packages/alabaster/__init__.py
#   sphinx.ext.autodoc.type_comment (3.0.0) from /usr/local/lib/python3.8/site-packages/sphinx/ext/autodoc/type_comment.py
#   sphinx.ext.autodoc (3.0.0) from /usr/local/lib/python3.8/site-packages/sphinx/ext/autodoc/__init__.py
#   sphinx.ext.doctest (3.0.0) from /usr/local/lib/python3.8/site-packages/sphinx/ext/doctest.py
#   sphinx.ext.imgmath (3.0.0) from /usr/local/lib/python3.8/site-packages/sphinx/ext/imgmath.py
#   sphinx.ext.graphviz (3.0.0) from /usr/local/lib/python3.8/site-packages/sphinx/ext/graphviz.py
#   sphinx.ext.inheritance_diagram (3.0.0) from /usr/local/lib/python3.8/site-packages/sphinx/ext/inheritance_diagram.py
#   sphinx.ext.viewcode (3.0.0) from /usr/local/lib/python3.8/site-packages/sphinx/ext/viewcode.py
#   sphinx.ext.autosummary (3.0.0) from /usr/local/lib/python3.8/site-packages/sphinx/ext/autosummary/__init__.py
#   numpydoc (0.9.2) from /usr/local/lib/python3.8/site-packages/numpydoc/__init__.py
#   cmdhelp (unknown version) from /xonsh/docs/cmdhelp.py
#   runthis.sphinxext (unknown version) from /usr/local/lib/python3.8/site-packages/runthis/sphinxext.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/sphinx/cmd/build.py", line 280, in build_main
    app.build(args.force_all, filenames)
  File "/usr/local/lib/python3.8/site-packages/sphinx/application.py", line 348, in build
    self.builder.build_update()
  File "/usr/local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 297, in build_update
    self.build(to_build,
  File "/usr/local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 311, in build
    updated_docnames = set(self.read())
  File "/usr/local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 418, in read
    self._read_serial(docnames)
  File "/usr/local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 439, in _read_serial
    self.read_doc(docname)
  File "/usr/local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 479, in read_doc
    doctree = read_doc(self.app, self.env, self.env.doc2path(docname))
  File "/usr/local/lib/python3.8/site-packages/sphinx/io.py", line 221, in read_doc
    pub.publish()
  File "/usr/local/lib/python3.8/site-packages/docutils/core.py", line 217, in publish
    self.document = self.reader.read(self.source, self.parser,
  File "/usr/local/lib/python3.8/site-packages/sphinx/io.py", line 126, in read
    self.parse()
  File "/usr/local/lib/python3.8/site-packages/docutils/readers/__init__.py", line 77, in parse
    self.parser.parse(self.input, document)
  File "/usr/local/lib/python3.8/site-packages/sphinx/parsers.py", line 102, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "/usr/local/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 170, in run
    results = StateMachineWS.run(self, input_lines, input_offset,
  File "/usr/local/lib/python3.8/site-packages/docutils/statemachine.py", line 241, in run
    context, next_state, result = self.check_line(
  File "/usr/local/lib/python3.8/site-packages/docutils/statemachine.py", line 459, in check_line
    return method(match, context, next_state)
  File "/usr/local/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 3005, in text
    self.section(title.lstrip(), source, style, lineno + 1, messages)
  File "/usr/local/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/usr/local/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 393, in new_subsection
    newabsoffset = self.nested_parse(
  File "/usr/local/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 281, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "/usr/local/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 196, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/usr/local/lib/python3.8/site-packages/docutils/statemachine.py", line 241, in run
    context, next_state, result = self.check_line(
  File "/usr/local/lib/python3.8/site-packages/docutils/statemachine.py", line 459, in check_line
    return method(match, context, next_state)
  File "/usr/local/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 2342, in explicit_markup
    nodelist, blank_finish = self.explicit_construct(match)
  File "/usr/local/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 2354, in explicit_construct
    return method(self, expmatch)
  File "/usr/local/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 2096, in directive
    return self.run_directive(
  File "/usr/local/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 2146, in run_directive
    result = directive_instance.run()
  File "/usr/local/lib/python3.8/site-packages/sphinx/ext/autodoc/directive.py", line 146, in run
    documenter.generate(more_content=self.content)
  File "/usr/local/lib/python3.8/site-packages/sphinx/ext/autodoc/__init__.py", line 769, in generate
    self.document_members(all_members)
  File "/usr/local/lib/python3.8/site-packages/sphinx/ext/autodoc/__init__.py", line 659, in document_members
    for (mname, member, isattr) in self.filter_members(members, want_all):
  File "/usr/local/lib/python3.8/site-packages/sphinx/ext/autodoc/__init__.py", line 570, in filter_members
    metadata = extract_metadata(doc)
  File "/usr/local/lib/python3.8/site-packages/sphinx/util/docstrings.py", line 29, in extract_metadata
    for line in prepare_docstring(s):
  File "/usr/local/lib/python3.8/site-packages/sphinx/util/docstrings.py", line 54, in prepare_docstring
    lines = s.expandtabs(tabsize).splitlines()
AttributeError: 'getset_descriptor' object has no attribute 'expandtabs'

Steps to reproduce:

$ git clone https://github.com/xonsh/xonsh.git
$ cd xonsh/docs
$ make html
@tk0miya
Copy link
Member

tk0miya commented Apr 9, 2020

Wow, it seems one of the object in your library returns non-string object as a __doc__ member. I feel this is broken, but okay, I'll fix this later.

<attribute '__doc__' of 'builtin_function_or_method' objects>

@laloch
Copy link
Author

laloch commented Apr 9, 2020

Oops, you're absolutely right:

>>> type(xonsh.inspectors._builtin_func_type.__doc__)
getset_descriptor
>>> type(xonsh.inspectors._builtin_meth_type.__doc__)
getset_descriptor

tk0miya added a commit that referenced this issue Apr 10, 2020
…ring

Fix #7451: autodoc: failed with non-string __doc__ member
@tk0miya tk0miya closed this as completed Apr 10, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 26, 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