mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Close #2820: autoclass directive supports nested class
This commit is contained in:
parent
85881897e0
commit
8c29801f27
1
CHANGES
1
CHANGES
@ -162,6 +162,7 @@ Features added
|
|||||||
if :confval:`latex_engine` is ``'xelatex'`` or ``'lualatex'``.
|
if :confval:`latex_engine` is ``'xelatex'`` or ``'lualatex'``.
|
||||||
* #4976: ``SphinxLoggerAdapter.info()`` now supports ``location`` parameter
|
* #4976: ``SphinxLoggerAdapter.info()`` now supports ``location`` parameter
|
||||||
* #5122: setuptools: support nitpicky option
|
* #5122: setuptools: support nitpicky option
|
||||||
|
* #2820: autoclass directive supports nested class
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
@ -167,8 +167,21 @@ def import_object(modname, objpath, objtype='', attrgetter=safe_getattr, warning
|
|||||||
logger.debug('[autodoc] import %s', modname)
|
logger.debug('[autodoc] import %s', modname)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
module = import_module(modname, warningiserror=warningiserror)
|
module = None
|
||||||
logger.debug('[autodoc] => %r', module)
|
objpath = list(objpath)
|
||||||
|
while module is None:
|
||||||
|
try:
|
||||||
|
module = import_module(modname, warningiserror=warningiserror)
|
||||||
|
logger.debug('[autodoc] import %s => %r', modname, module)
|
||||||
|
except ImportError:
|
||||||
|
logger.debug('[autodoc] import %s => failed', modname)
|
||||||
|
if '.' in modname:
|
||||||
|
# retry with parent module
|
||||||
|
modname, name = modname.rsplit('.', 1)
|
||||||
|
objpath.insert(0, name)
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
obj = module
|
obj = module
|
||||||
parent = None
|
parent = None
|
||||||
object_name = None
|
object_name = None
|
||||||
|
@ -771,6 +771,9 @@ def test_generate():
|
|||||||
('class', 'target.Outer.Inner'),
|
('class', 'target.Outer.Inner'),
|
||||||
('method', 'target.Outer.Inner.meth')],
|
('method', 'target.Outer.Inner.meth')],
|
||||||
'class', 'Outer', all_members=True)
|
'class', 'Outer', all_members=True)
|
||||||
|
assert_processes([('class', 'target.Outer.Inner'),
|
||||||
|
('method', 'target.Outer.Inner.meth')],
|
||||||
|
'class', 'target.Outer.Inner', all_members=True)
|
||||||
|
|
||||||
# test descriptor docstrings
|
# test descriptor docstrings
|
||||||
assert_result_contains(' Descriptor instance docstring.',
|
assert_result_contains(' Descriptor instance docstring.',
|
||||||
|
Loading…
Reference in New Issue
Block a user