diff --git a/CHANGES b/CHANGES index 0e5784113..9dfca4ee3 100644 --- a/CHANGES +++ b/CHANGES @@ -79,7 +79,7 @@ Bugs fixed Testing -------- -Release 3.5.1 (in development) +Release 3.5.2 (in development) ============================== Dependencies @@ -100,6 +100,20 @@ Bugs fixed Testing -------- +Release 3.5.1 (released Feb 16, 2021) +===================================== + +Bugs fixed +---------- + +* #8883: autodoc: AttributeError is raised on assigning __annotations__ on + read-only class +* #8884: html: minified js stemmers not included in the distributed package +* #8885: html: AttributeError is raised if CSS/JS files are installed via + :confval:`html_context` +* #8880: viewcode: ExtensionError is raised on incremental build after + unparsable python module found + Release 3.5.0 (released Feb 14, 2021) ===================================== diff --git a/MANIFEST.in b/MANIFEST.in index 54da42895..1114ca19f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -22,6 +22,7 @@ recursive-include sphinx/texinputs_win * recursive-include sphinx/themes * recursive-include sphinx/locale *.js *.pot *.po *.mo recursive-include sphinx/search/non-minified-js *.js +recursive-include sphinx/search/minified-js *.js recursive-include sphinx/ext/autosummary/templates * recursive-include tests * recursive-include utils * diff --git a/sphinx/builders/html/__init__.py b/sphinx/builders/html/__init__.py index f818566ac..a68594a6d 100644 --- a/sphinx/builders/html/__init__.py +++ b/sphinx/builders/html/__init__.py @@ -1035,8 +1035,20 @@ class StandaloneHTMLBuilder(Builder): templatename = newtmpl # sort JS/CSS before rendering HTML - ctx['script_files'].sort(key=lambda js: js.priority) - ctx['css_files'].sort(key=lambda js: js.priority) + try: + # Convert script_files to list to support non-list script_files (refs: #8889) + ctx['script_files'] = sorted(list(ctx['script_files']), key=lambda js: js.priority) + except AttributeError: + # Skip sorting if users modifies script_files directly (maybe via `html_context`). + # refs: #8885 + # + # Note: priority sorting feature will not work in this case. + pass + + try: + ctx['css_files'] = sorted(list(ctx['css_files']), key=lambda css: css.priority) + except AttributeError: + pass try: output = self.templates.render(templatename, ctx) diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index 699787fb6..2ac24ebff 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -1377,7 +1377,7 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ params[0] = params[0].replace(annotation=typ) try: func.__signature__ = sig.replace(parameters=params) # type: ignore - except TypeError: + except (AttributeError, TypeError): # failed to update signature (ex. built-in or extension types) return @@ -2156,7 +2156,7 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter): # type: params[1] = params[1].replace(annotation=typ) try: func.__signature__ = sig.replace(parameters=params) # type: ignore - except TypeError: + except (AttributeError, TypeError): # failed to update signature (ex. built-in or extension types) return @@ -2422,7 +2422,7 @@ class AttributeDocumenter(GenericAliasMixin, NewTypeMixin, SlotsMixin, # type: annotations[attrname] = annotation except (AttributeError, PycodeError): pass - except TypeError: + except (AttributeError, TypeError): # Failed to set __annotations__ (built-in, extensions, etc.) pass diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py index 21cff6a03..6bedf2e1c 100644 --- a/sphinx/ext/viewcode.py +++ b/sphinx/ext/viewcode.py @@ -152,7 +152,11 @@ def env_merge_info(app: Sphinx, env: BuildEnvironment, docnames: Iterable[str], def env_purge_doc(app: Sphinx, env: BuildEnvironment, docname: str) -> None: modules = getattr(env, '_viewcode_modules', {}) - for modname, (code, tags, used, refname) in list(modules.items()): + for modname, entry in list(modules.items()): + if entry is False: + continue + + code, tags, used, refname = entry for fullname in list(used): if used[fullname] == docname: used.pop(fullname) diff --git a/tests/test_build_html.py b/tests/test_build_html.py index 3df65245c..fccf9cc6a 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -1597,7 +1597,14 @@ def test_html_codeblock_linenos_style_table(app): app.build() content = (app.outdir / 'index.html').read_text() - assert '
1\n2\n3\n4
1\n' + '2\n' + '3\n' + '4
1\n2\n3\n4