Merge branch '3.3.x' into 3.x

This commit is contained in:
Takeshi KOMIYA 2020-11-10 20:40:55 +09:00
commit 9154bc5456
6 changed files with 21 additions and 11 deletions

View File

@ -57,6 +57,11 @@ Features added
Bugs fixed
----------
* #8372: autodoc: autoclass directive became slower than Sphinx-3.2
* #7727: autosummary: raise PycodeError when documenting python package
without __init__.py
* #8364: C, properly initialize attributes in empty symbols.
Testing
--------

View File

@ -1533,6 +1533,7 @@ class Symbol:
self.declaration = declaration
self.declaration.symbol = self
self.docname = docname
self.line = line
self._assert_invariants()
# and symbol addition should be done as well
self._add_function_params()

View File

@ -1554,6 +1554,9 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
qualname = '.'.join([cls.__qualname__, self._signature_method_name])
if qualname in analyzer.overloads:
return analyzer.overloads.get(qualname)
elif qualname in analyzer.tagorder:
# the constructor is defined in the class, but not overrided.
return []
except PycodeError:
pass

View File

@ -694,7 +694,7 @@ def import_ivar_by_name(name: str, prefixes: List[str] = [None]) -> Tuple[str, A
analyzer = ModuleAnalyzer.for_module(modname)
if (qualname, attr) in analyzer.find_attr_docs():
return real_name + "." + attr, INSTANCEATTR, obj, modname
except (ImportError, ValueError):
except (ImportError, ValueError, PycodeError):
pass
raise ImportError

View File

@ -150,9 +150,13 @@ class ModuleAnalyzer:
self.overloads = None # type: Dict[str, List[Signature]]
self.tagorder = None # type: Dict[str, int]
self.tags = None # type: Dict[str, Tuple[str, int, int]]
self._parsed = False
def parse(self) -> None:
"""Parse the source code."""
if self._parsed:
return None
try:
parser = Parser(self.code, self._encoding)
parser.parse()
@ -169,21 +173,18 @@ class ModuleAnalyzer:
self.overloads = parser.overloads
self.tags = parser.definitions
self.tagorder = parser.deforders
self._parsed = True
except Exception as exc:
raise PycodeError('parsing %r failed: %r' % (self.srcname, exc)) from exc
def find_attr_docs(self) -> Dict[Tuple[str, str], List[str]]:
"""Find class and module-level attributes and their documentation."""
if self.attr_docs is None:
self.parse()
self.parse()
return self.attr_docs
def find_tags(self) -> Dict[str, Tuple[str, int, int]]:
"""Find class, function and method definitions and their location."""
if self.tags is None:
self.parse()
self.parse()
return self.tags
@property

View File

@ -4,7 +4,7 @@ Release checklist
for stable releases
-------------------
* open https://travis-ci.org/sphinx-doc/sphinx/branches and check **X.Y** branch is green
* open https://github.com/sphinx-doc/sphinx/actions?query=branch:X.Y.x and all tests has passed
* Run ``git fetch; git status`` and check nothing changed
* ``python utils/bump_version.py X.Y.Z``
* Check diff by ``git diff``
@ -28,7 +28,7 @@ for stable releases
for first beta releases
-----------------------
* open https://travis-ci.org/sphinx-doc/sphinx/branches and check **master** branch is green
* open https://github.com/sphinx-doc/sphinx/actions?query=branch:master and all tests has passed
* Run ``git fetch; git status`` and check nothing changed
* Run ``python setup.py extract_messages``
* Run ``(cd sphinx/locale; tx push -s)``
@ -58,7 +58,7 @@ for first beta releases
for other beta releases
-----------------------
* open https://travis-ci.org/sphinx-doc/sphinx/branches and check **X.Y** branch is green
* open https://github.com/sphinx-doc/sphinx/actions?query=branch:X.x and all tests has passed
* Run ``git fetch; git status`` and check nothing changed
* ``python utils/bump_version.py X.Y.0bN``
* Check diff by ``git diff``
@ -81,7 +81,7 @@ for other beta releases
for major releases
------------------
* open https://travis-ci.org/sphinx-doc/sphinx/branches and check **X.Y** branch is green
* open https://github.com/sphinx-doc/sphinx/actions?query=branch:X.x and all tests has passed
* Run ``git fetch; git status`` and check nothing changed
* Run ``(cd sphinx/locale; tx pull -a -f)``
* Run ``python setup.py compile_catalog``