diff options
-rw-r--r-- | CHANGES | 8 | ||||
-rw-r--r-- | sphinx/domains/c.py | 1 | ||||
-rw-r--r-- | sphinx/ext/autodoc/__init__.py | 3 | ||||
-rw-r--r-- | sphinx/ext/autosummary/__init__.py | 2 | ||||
-rw-r--r-- | sphinx/pycode/__init__.py | 13 | ||||
-rw-r--r-- | utils/release-checklist | 8 |
6 files changed, 22 insertions, 13 deletions
@@ -21,6 +21,8 @@ Features added * #8119: autodoc: Allow to determine whether a member not included in ``__all__`` attribute of the module should be documented or not via :event:`autodoc-skip-member` event +* #8219: autodoc: Parameters for generic class are not shown when super class is + a generic class and show-inheritance option is given (in Python 3.7 or above) * autodoc: Add ``Documenter.config`` as a shortcut to access the config object * autodoc: Add Optional[t] to annotation of function and method if a default value equal to None is set. @@ -57,8 +59,10 @@ Features added Bugs fixed ---------- -* #8219: autodoc: Parameters for generic class are not shown when super class is - a generic class and show-inheritance option is given (in Python 3.7 or above) +* #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 -------- diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py index e3570b593..5896f4a80 100644 --- a/sphinx/domains/c.py +++ b/sphinx/domains/c.py @@ -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() diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index 3c9d9cead..80e525e1c 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -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 diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py index 0fb7c9fc5..faee7716a 100644 --- a/sphinx/ext/autosummary/__init__.py +++ b/sphinx/ext/autosummary/__init__.py @@ -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 diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py index 4fef4a394..b7163072f 100644 --- a/sphinx/pycode/__init__.py +++ b/sphinx/pycode/__init__.py @@ -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 diff --git a/utils/release-checklist b/utils/release-checklist index 582d26685..dad83c850 100644 --- a/utils/release-checklist +++ b/utils/release-checklist @@ -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`` |