Merge branch '3.x'

This commit is contained in:
Takeshi KOMIYA 2021-02-17 00:16:32 +09:00
commit f9ca909ea0
6 changed files with 46 additions and 8 deletions

16
CHANGES
View File

@ -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)
=====================================

View File

@ -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 *

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -1597,6 +1597,13 @@ def test_html_codeblock_linenos_style_table(app):
app.build()
content = (app.outdir / 'index.html').read_text()
pygments_version = tuple(LooseVersion(pygments.__version__).version)
if pygments_version >= (2, 8):
assert ('<div class="linenodiv"><pre><span class="normal">1</span>\n'
'<span class="normal">2</span>\n'
'<span class="normal">3</span>\n'
'<span class="normal">4</span></pre></div>') in content
else:
assert '<div class="linenodiv"><pre>1\n2\n3\n4</pre></div>' in content