Merge branch 'stable' into 1.6-release

This commit is contained in:
Takeshi KOMIYA 2017-04-25 00:40:04 +09:00
commit e3d14e7862
4 changed files with 29 additions and 6 deletions

View File

@ -210,6 +210,9 @@ Features added
Bugs fixed Bugs fixed
---------- ----------
* #3614: Sphinx crashes with requests-2.5.0
* #3618: autodoc crashes with tupled arguments
Testing Testing
-------- --------

View File

@ -64,6 +64,7 @@ clean-backupfiles:
clean-generated: clean-generated:
find . -name '.DS_Store' -exec rm -f {} + find . -name '.DS_Store' -exec rm -f {} +
rm -rf Sphinx.egg-info/
rm -rf doc/_build/ rm -rf doc/_build/
rm -f sphinx/pycode/*.pickle rm -f sphinx/pycode/*.pickle
rm -f utils/*3.py* rm -f utils/*3.py*

View File

@ -473,10 +473,19 @@ def formatargspec(function, args, varargs=None, varkw=None, defaults=None,
for i, arg in enumerate(args): for i, arg in enumerate(args):
arg_fd = StringIO() arg_fd = StringIO()
arg_fd.write(format_arg_with_annotation(arg)) if isinstance(arg, list):
if defaults and i >= defaults_start: # support tupled arguments list (only for py2): def foo((x, y))
arg_fd.write(' = ' if arg in annotations else '=') arg_fd.write('(')
arg_fd.write(object_description(defaults[i - defaults_start])) # type: ignore arg_fd.write(format_arg_with_annotation(arg[0]))
for param in arg[1:]:
arg_fd.write(', ')
arg_fd.write(format_arg_with_annotation(param))
arg_fd.write(')')
else:
arg_fd.write(format_arg_with_annotation(arg))
if defaults and i >= defaults_start:
arg_fd.write(' = ' if arg in annotations else '=')
arg_fd.write(object_description(defaults[i - defaults_start])) # type: ignore
formatted.append(arg_fd.getvalue()) formatted.append(arg_fd.getvalue())
if varargs: if varargs:

View File

@ -36,6 +36,16 @@ except ImportError:
# for requests < 2.4.0 # for requests < 2.4.0
InsecureRequestWarning = None InsecureRequestWarning = None
try:
from requests.packages.urllib3.exceptions import InsecurePlatformWarning
except ImportError:
try:
# for Debian-jessie
from urllib3.exceptions import InsecurePlatformWarning
except ImportError:
# for requests < 2.4.0
InsecurePlatformWarning = None
# try to load requests[security] (but only if SSL is available) # try to load requests[security] (but only if SSL is available)
try: try:
import ssl import ssl
@ -48,8 +58,8 @@ else:
pkg_resources.VersionConflict): pkg_resources.VersionConflict):
if not getattr(ssl, 'HAS_SNI', False): if not getattr(ssl, 'HAS_SNI', False):
# don't complain on each url processed about the SSL issue # don't complain on each url processed about the SSL issue
requests.packages.urllib3.disable_warnings( if InsecurePlatformWarning:
requests.packages.urllib3.exceptions.InsecurePlatformWarning) requests.packages.urllib3.disable_warnings(InsecurePlatformWarning)
warnings.warn( warnings.warn(
'Some links may return broken results due to being unable to ' 'Some links may return broken results due to being unable to '
'check the Server Name Indication (SNI) in the returned SSL cert ' 'check the Server Name Indication (SNI) in the returned SSL cert '