diff --git a/CHANGES b/CHANGES index a5a70802e..23052945f 100644 --- a/CHANGES +++ b/CHANGES @@ -80,6 +80,7 @@ Bugs fixed longtable class or not (refs #3686) * #3725: Todo looks different from note in LaTeX output * #3479: stub-columns have no effect in LaTeX output +* #3738: Nonsensical code in theming.py Testing -------- @@ -344,6 +345,8 @@ Bugs fixed * #3702: LaTeX writer styles figure legends with a hard-coded ``\small`` * #3708: LaTeX writer allows irc scheme * #3717: Stop enforcing that favicon's must be .ico +* #3731, #3732: Protect isenumclass predicate against non-class arguments +* #3320: Warning about reference target not being found for container types Testing -------- diff --git a/doc/latex.rst b/doc/latex.rst index 59f1ce233..fc872342a 100644 --- a/doc/latex.rst +++ b/doc/latex.rst @@ -510,11 +510,18 @@ Let us now list some macros from the package file .. hint:: As an experimental feature, Sphinx can use user-defined template file for - LaTeX source if you have a file named ``_templates/latex.tex_t`` on your - project. Now all template variables are unstable and undocumented. They - will be changed in future version. + LaTeX source if you have a file named ``_templates/latex.tex_t`` in your + project. .. versionadded:: 1.5 + currently all template variables are unstable and undocumented. + + Additional files ``longtable.tex_t``, ``tabulary.tex_t`` and + ``tabular.tex_t`` can be added to ``_templates/`` to configure some aspects + of table rendering (such as the caption position). + + .. versionadded:: 1.6 + currently all template variables are unstable and undocumented. .. raw:: latex diff --git a/sphinx/application.py b/sphinx/application.py index 63834b119..e16220103 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -203,9 +203,9 @@ class Sphinx(object): self.config.setup(self) else: raise ConfigError( - _("'setup' that is specified in the conf.py has not been " - "callable. Please provide a callable `setup` function " - "in order to behave as a sphinx extension conf.py itself.") + _("'setup' as currently defined in conf.py isn't a Python callable. " + "Please modify its definition to make it a callable function. This is " + "needed for conf.py to behave as a Sphinx extension.") ) # now that we know all config values, collect them from conf.py @@ -416,7 +416,7 @@ class Sphinx(object): def connect(self, event, callback): # type: (unicode, Callable) -> int listener_id = self.events.connect(event, callback) - logger.debug('[app] connecting event %r: %r', event, callback, listener_id) + logger.debug('[app] connecting event %r: %r [id=%s]', event, callback, listener_id) return listener_id def disconnect(self, listener_id): @@ -462,7 +462,7 @@ class Sphinx(object): def set_translator(self, name, translator_class): # type: (unicode, Type[nodes.NodeVisitor]) -> None - logger.info(bold(_('A Translator for the %s builder is changed.') % name)) + logger.info(bold(_('Change of translator for the %s builder.') % name)) self.registry.add_translator(name, translator_class) def add_node(self, node, **kwds): diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index 28ea1a08a..eb6fe76cb 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -135,7 +135,7 @@ class PyXrefMixin(object): split_contnode = bool(contnode and contnode.astext() == target) results = [] - for sub_target in sub_targets: + for sub_target in filter(None, sub_targets): if split_contnode: contnode = nodes.Text(sub_target) diff --git a/sphinx/extension.py b/sphinx/extension.py index 82fd2d976..c3b3b901e 100644 --- a/sphinx/extension.py +++ b/sphinx/extension.py @@ -50,9 +50,8 @@ def verify_required_extensions(app, requirements): for extname, reqversion in iteritems(requirements): extension = app.extensions.get(extname) if extension is None: - logger.warning(_('needs_extensions config value specifies a ' - 'version requirement for extension %s, but it is ' - 'not loaded'), extname) + logger.warning(_('The %s extension is required by needs_extensions settings,' + 'but it is not loaded.'), extname) continue if extension.version == 'unknown version' or reqversion > extension.version: diff --git a/sphinx/theming.py b/sphinx/theming.py index c769cfda0..7a11f4bbf 100644 --- a/sphinx/theming.py +++ b/sphinx/theming.py @@ -233,8 +233,8 @@ class HTMLThemeFactory(object): target = entry_point.load() if callable(target): themedir = target() - if not isinstance(path, string_types): - logger.warning(_('Theme extension %r does not response correctly.') % + if not isinstance(themedir, string_types): + logger.warning(_('Theme extension %r does not respond correctly.') % entry_point.module_name) else: themedir = target diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index 2ae31db15..5e0d219ec 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -142,7 +142,7 @@ def isenumclass(x): """Check if the object is subclass of enum.""" if enum is None: return False - return issubclass(x, enum.Enum) + return inspect.isclass(x) and issubclass(x, enum.Enum) def isenumattribute(x): diff --git a/tests/roots/test-domain-py/module.rst b/tests/roots/test-domain-py/module.rst index f3f138639..deb54629e 100644 --- a/tests/roots/test-domain-py/module.rst +++ b/tests/roots/test-domain-py/module.rst @@ -29,3 +29,10 @@ module .. py:class:: ModTopLevel * Link to :py:class:`ModNoModule` + +.. py:function:: foo(x, y) + + :param x: param x + :type x: int + :param y: param y + :type y: tuple(str, float) diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py index eb8a7a178..383dd8d33 100644 --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -109,7 +109,11 @@ def test_domain_py_xrefs(app, status, warning): 'ModTopLevel', 'class') assert_refnode(refnodes[6], 'module_b.submodule', 'ModTopLevel', 'ModNoModule', 'class') - assert len(refnodes) == 7 + assert_refnode(refnodes[7], False, False, 'int', 'obj') + assert_refnode(refnodes[8], False, False, 'tuple', 'obj') + assert_refnode(refnodes[9], False, False, 'str', 'obj') + assert_refnode(refnodes[10], False, False, 'float', 'obj') + assert len(refnodes) == 11 @pytest.mark.sphinx('dummy', testroot='domain-py')