sphinx-autodoc-typehints: Apparent incompatibility with slot wrappers
Here’s a traceback for you. I’ve found this error appears on any class that doesn’t explicitly define an __init__() - which means that the __init__ in its dict refers to a C method wrapper.
Python 3.6.
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\sphinx\cmdline.py", line 296, in main
app.build(opts.force_all, filenames)
File "C:\Python36\lib\site-packages\sphinx\application.py", line 333, in build
self.builder.build_update()
File "C:\Python36\lib\site-packages\sphinx\builders\__init__.py", line 251, in build_update
'out of date' % len(to_build))
File "C:\Python36\lib\site-packages\sphinx\builders\__init__.py", line 265, in build
self.doctreedir, self.app))
File "C:\Python36\lib\site-packages\sphinx\environment\__init__.py", line 556, in update
self._read_serial(docnames, app)
File "C:\Python36\lib\site-packages\sphinx\environment\__init__.py", line 576, in _read_serial
self.read_doc(docname, app)
File "C:\Python36\lib\site-packages\sphinx\environment\__init__.py", line 684, in read_doc
pub.publish()
File "C:\Python36\lib\site-packages\docutils\core.py", line 217, in publish
self.settings)
File "C:\Python36\lib\site-packages\sphinx\io.py", line 55, in read
self.parse()
File "C:\Python36\lib\site-packages\docutils\readers\__init__.py", line 78, in parse
self.parser.parse(self.input, document)
File "C:\Python36\lib\site-packages\docutils\parsers\rst\__init__.py", line 185, in parse
self.statemachine.run(inputlines, document, inliner=self.inliner)
File "C:\Python36\lib\site-packages\docutils\parsers\rst\states.py", line 170, in run
input_source=document['source'])
File "C:\Python36\lib\site-packages\docutils\statemachine.py", line 239, in run
context, state, transitions)
File "C:\Python36\lib\site-packages\docutils\statemachine.py", line 460, in check_line
return method(match, context, next_state)
File "C:\Python36\lib\site-packages\docutils\parsers\rst\states.py", line 2745, in underline
self.section(title, source, style, lineno - 1, messages)
File "C:\Python36\lib\site-packages\docutils\parsers\rst\states.py", line 326, in section
self.new_subsection(title, lineno, messages)
File "C:\Python36\lib\site-packages\docutils\parsers\rst\states.py", line 394, in new_subsection
node=section_node, match_titles=True)
File "C:\Python36\lib\site-packages\docutils\parsers\rst\states.py", line 281, in nested_parse
node=node, match_titles=match_titles)
File "C:\Python36\lib\site-packages\docutils\parsers\rst\states.py", line 195, in run
results = StateMachineWS.run(self, input_lines, input_offset)
File "C:\Python36\lib\site-packages\docutils\statemachine.py", line 239, in run
context, state, transitions)
File "C:\Python36\lib\site-packages\docutils\statemachine.py", line 460, in check_line
return method(match, context, next_state)
File "C:\Python36\lib\site-packages\docutils\parsers\rst\states.py", line 2318, in explicit_markup
nodelist, blank_finish = self.explicit_construct(match)
File "C:\Python36\lib\site-packages\docutils\parsers\rst\states.py", line 2330, in explicit_construct
return method(self, expmatch)
File "C:\Python36\lib\site-packages\docutils\parsers\rst\states.py", line 2073, in directive
directive_class, match, type_name, option_presets)
File "C:\Python36\lib\site-packages\docutils\parsers\rst\states.py", line 2122, in run_directive
result = directive_instance.run()
File "C:\Python36\lib\site-packages\sphinx\ext\autodoc.py", line 1647, in run
documenter.generate(more_content=self.content)
File "C:\Python36\lib\site-packages\sphinx\ext\autodoc.py", line 992, in generate
self.document_members(all_members)
File "C:\Python36\lib\site-packages\sphinx\ext\autodoc.py", line 914, in document_members
check_module=members_check_module and not isattr)
File "C:\Python36\lib\site-packages\sphinx\ext\autodoc.py", line 989, in generate
self.add_content(more_content)
File "C:\Python36\lib\site-packages\sphinx\ext\autodoc.py", line 1362, in add_content
ModuleLevelDocumenter.add_content(self, more_content)
File "C:\Python36\lib\site-packages\sphinx\ext\autodoc.py", line 723, in add_content
for i, line in enumerate(self.process_doc(docstrings)):
File "C:\Python36\lib\site-packages\sphinx\ext\autodoc.py", line 685, in process_doc
self.options, docstringlines)
File "C:\Python36\lib\site-packages\sphinx\application.py", line 589, in emit
results.append(callback(self, *args))
File "C:\Python36\lib\site-packages\sphinx_autodoc_typehints.py", line 68, in process_docstring
type_hints = get_type_hints(obj)
File "C:\Python36\lib\typing.py", line 1419, in get_type_hints
'or function.'.format(obj))
TypeError: <slot wrapper '__init__' of 'object' objects> is not a module, class, method, or function.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 23 (2 by maintainers)
Commits related to this issue
- avoid https://github.com/agronholm/sphinx-autodoc-typehints/issues/12 — committed to kazuki/sphinx-autodoc-typehints by kazuki 7 years ago
Manual testing revealed that the exact reported issue had not actually been fixed.
The test suite now passes on 3.5.3 locally. Next I will fix the regressions introduced for 3.5.0.
This will now get more attention from me as it’s blocking the release of my other project, Asphalt 3.0.