Merge branch 'stable'

This commit is contained in:
Takeshi KOMIYA 2016-08-08 00:40:42 +09:00
commit a9da999d71
6 changed files with 24 additions and 8 deletions

View File

@ -120,6 +120,9 @@ Bugs fixed
* #2778: Fix autodoc crashes if obj.__dict__ is a property method and raises exception
* Fix duplicated toc in epub3 output.
* #2775: Fix failing linkcheck with servers not supporting identidy encoding
* #2833: Fix formatting instance annotations in ext.autodoc.
* #1911: ``-D`` option of `sphinx-build` does not override the ``extensions`` variable
Release 1.4.5 (released Jul 13, 2016)
=====================================

View File

@ -61,6 +61,7 @@ Documentation using the classic theme
* Quex: http://quex.sourceforge.net/doc/html/main.html
* Ring programming language: http://ring-lang.sourceforge.net/doc/index.html
* Scapy: http://www.secdev.org/projects/scapy/doc/
* Seaborn: https://stanford.edu/~mwaskom/software/seaborn/
* Segway: http://noble.gs.washington.edu/proj/segway/doc/1.1.0/segway.html
* SimPy: http://simpy.readthedocs.org/en/latest/
* SymPy: http://docs.sympy.org/

View File

@ -557,10 +557,10 @@ a visibility statement (``public``, ``private`` or ``protected``).
Full and partial template specialisations can be declared::
.. cpp::class:: template<> \
.. cpp:class:: template<> \
std::array<bool, 256>
.. cpp::class:: template<typename T> \
.. cpp:class:: template<typename T> \
std::array<T, 42>
@ -692,9 +692,9 @@ a visibility statement (``public``, ``private`` or ``protected``).
Describe an enumerator, optionally with its value defined, e.g.,::
.. cpp::enumerator:: MyEnum::myEnumerator
.. cpp:enumerator:: MyEnum::myEnumerator
.. cpp::enumerator:: MyEnum::myOtherEnumerator = 42
.. cpp:enumerator:: MyEnum::myOtherEnumerator = 42
Namespacing

View File

@ -261,12 +261,13 @@ def format_annotation(annotation):
Displaying complex types from ``typing`` relies on its private API.
"""
if not isinstance(annotation, type):
return repr(annotation)
qualified_name = (annotation.__module__ + '.' + annotation.__qualname__
if annotation else repr(annotation))
if not isinstance(annotation, type):
return repr(annotation)
elif annotation.__module__ == 'builtins':
if annotation.__module__ == 'builtins':
return annotation.__qualname__
elif typing:
if isinstance(annotation, typing.TypeVar):

View File

@ -1025,7 +1025,7 @@ def test_type_hints():
from sphinx.util.inspect import getargspec
try:
from typing_test_data import f0, f1, f2, f3, f4, f5, f6, f7, f8
from typing_test_data import f0, f1, f2, f3, f4, f5, f6, f7, f8, f9
except (ImportError, SyntaxError):
raise SkipTest('Cannot import Python code with function annotations')
@ -1061,3 +1061,6 @@ def test_type_hints():
# Tuple types
verify_arg_spec(f8, '(x: typing.Tuple[int, str],'
' y: typing.Tuple[int, ...]) -> None')
# Instance annotations
verify_arg_spec(f9, '(x: CustomAnnotation, y: 123) -> None')

View File

@ -46,3 +46,11 @@ def f7(x: Callable[[int, str], int]) -> None:
def f8(x: Tuple[int, str], y: Tuple[int, ...]) -> None:
pass
class CustomAnnotation:
def __repr__(self):
return 'CustomAnnotation'
def f9(x: CustomAnnotation(), y: 123) -> None:
pass