mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix autodoc crash if :members: and :special-members: ware both set (by d7ac5e4).
This commit is contained in:
parent
e70a43a9c5
commit
70f3f889d1
@ -592,6 +592,7 @@ class Documenter(object):
|
|||||||
membername != '__doc__':
|
membername != '__doc__':
|
||||||
keep = has_doc or self.options.undoc_members
|
keep = has_doc or self.options.undoc_members
|
||||||
elif self.options.special_members and \
|
elif self.options.special_members and \
|
||||||
|
self.options.special_members is not ALL and \
|
||||||
membername in self.options.special_members:
|
membername in self.options.special_members:
|
||||||
keep = has_doc or self.options.undoc_members
|
keep = has_doc or self.options.undoc_members
|
||||||
elif want_all and membername.startswith('_'):
|
elif want_all and membername.startswith('_'):
|
||||||
|
@ -90,6 +90,8 @@ def process_signature(app, what, name, obj, options, args, retann):
|
|||||||
|
|
||||||
|
|
||||||
def skip_member(app, what, name, obj, skip, options):
|
def skip_member(app, what, name, obj, skip, options):
|
||||||
|
if name in ('__special1__', '__special2__'):
|
||||||
|
return skip
|
||||||
if name.startswith('_'):
|
if name.startswith('_'):
|
||||||
return True
|
return True
|
||||||
if name == 'skipmeth':
|
if name == 'skipmeth':
|
||||||
@ -519,6 +521,15 @@ def test_generate():
|
|||||||
should.append(('method', 'test_autodoc.Class.inheritedmeth'))
|
should.append(('method', 'test_autodoc.Class.inheritedmeth'))
|
||||||
assert_processes(should, 'class', 'Class')
|
assert_processes(should, 'class', 'Class')
|
||||||
|
|
||||||
|
# test special members
|
||||||
|
options.special_members = ['__special1__']
|
||||||
|
should.append(('method', 'test_autodoc.Class.__special1__'))
|
||||||
|
assert_processes(should, 'class', 'Class')
|
||||||
|
options.special_members = ALL
|
||||||
|
should.append(('method', 'test_autodoc.Class.__special2__'))
|
||||||
|
assert_processes(should, 'class', 'Class')
|
||||||
|
options.special_members = False
|
||||||
|
|
||||||
options.members = []
|
options.members = []
|
||||||
# test module flags
|
# test module flags
|
||||||
assert_result_contains('.. py:module:: test_autodoc',
|
assert_result_contains('.. py:module:: test_autodoc',
|
||||||
@ -750,6 +761,13 @@ class Class(Base):
|
|||||||
self.inst_attr_string = None
|
self.inst_attr_string = None
|
||||||
"""a documented instance attribute"""
|
"""a documented instance attribute"""
|
||||||
|
|
||||||
|
def __special1__(self):
|
||||||
|
"""documented special method"""
|
||||||
|
|
||||||
|
def __special2__(self):
|
||||||
|
# undocumented special method
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CustomDict(dict):
|
class CustomDict(dict):
|
||||||
"""Docstring."""
|
"""Docstring."""
|
||||||
|
Loading…
Reference in New Issue
Block a user