Skip to content

Commit

Permalink
Merge branch '4.0.x' into 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Apr 19, 2021
2 parents 668bc9e + dfdc762 commit 53dff4e
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ Features added
--------------

* #8818: autodoc: Super class having ``Any`` arguments causes nit-picky warning
* #9095: autodoc: TypeError is raised on processing broken metaclass
* #9110: autodoc: metadata of GenericAlias is not rendered as a reference in
py37+
* #9098: html: copy-range protection for doctests doesn't work in Safari
* #9103: LaTeX: imgconverter: conversion runs even if not needed
* #8127: py domain: Ellipsis in info-field-list causes nit-picky warning
* #9023: More CSS classes on domain descriptions, see :ref:`nodes` for details.
Expand Down
4 changes: 2 additions & 2 deletions doc/usage/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ General configuration
Same as :confval:`root_doc`.

.. versionchanged:: 4.0
Renamed ``master_doc`` to ``master_doc``.
Renamed ``master_doc`` to ``root_doc``.

.. confval:: root_doc

Expand All @@ -196,7 +196,7 @@ General configuration
.. versionchanged:: 2.0
The default is changed to ``'index'`` from ``'contents'``.
.. versionchanged:: 4.0
Renamed ``master_doc`` from ``master_doc``.
Renamed ``root_doc`` from ``master_doc``.

.. confval:: exclude_patterns

Expand Down
3 changes: 1 addition & 2 deletions sphinx/ext/autodoc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1767,8 +1767,7 @@ def should_suppress_directive_header(self) -> bool:

def update_content(self, more_content: StringList) -> None:
if inspect.isgenericalias(self.object):
alias = stringify_typehint(self.object)
more_content.append(_('alias of %s') % alias, '')
more_content.append(_('alias of %s') % restify(self.object), '')
more_content.append('', '')

super().update_content(more_content)
Expand Down
9 changes: 8 additions & 1 deletion sphinx/ext/autodoc/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,14 @@ def import_object(modname: str, objpath: List[str], objtype: str = '',
logger.debug('[autodoc] getattr(_, %r)', attrname)
mangled_name = mangle(obj, attrname)
obj = attrgetter(obj, mangled_name)
logger.debug('[autodoc] => %r', obj)

try:
logger.debug('[autodoc] => %r', obj)
except TypeError:
# fallback of failure on logging for broken object
# refs: https://github.com/sphinx-doc/sphinx/issues/9095
logger.debug('[autodoc] => %r', (obj,))

object_name = attrname
return [module, parent, object_name, obj]
except (AttributeError, ImportError) as exc:
Expand Down
6 changes: 5 additions & 1 deletion sphinx/themes/basic/static/basic.css_t
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,11 @@ div.code-block-caption code {
table.highlighttable td.linenos,
span.linenos,
div.doctest > div.highlight span.gp { /* gp: Generic.Prompt */
user-select: none;
user-select: none;
-webkit-user-select: text; /* Safari fallback only */
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
}

div.code-block-caption span.caption-number {
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ext_autodoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1915,15 +1915,15 @@ def test_autodoc_GenericAlias(app):
'',
' A list of int',
'',
' alias of List[int]',
' alias of :class:`~typing.List`\\ [:class:`int`]',
'',
'',
'.. py:data:: T',
' :module: target.genericalias',
'',
' A list of int',
'',
' alias of List[int]',
' alias of :class:`~typing.List`\\ [:class:`int`]',
'',
]

Expand Down
2 changes: 1 addition & 1 deletion tests/test_ext_autodoc_autoattribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_autoattribute_GenericAlias(app):
'',
' A list of int',
'',
' alias of List[int]',
' alias of :class:`~typing.List`\\ [:class:`int`]',
'',
]

Expand Down
2 changes: 1 addition & 1 deletion tests/test_ext_autodoc_autodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_autodata_GenericAlias(app):
'',
' A list of int',
'',
' alias of List[int]',
' alias of :class:`~typing.List`\\ [:class:`int`]',
'',
]

Expand Down

0 comments on commit 53dff4e

Please sign in to comment.