Skip to content

Commit f886f08

Browse files
committed
Merge branch '1.7-release'
2 parents cfd9528 + 0a82ba0 commit f886f08

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

CHANGES

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Bugs fixed
4848

4949
* #4415: autodoc classifies inherited classmethods as regular methods
5050
* #4415: autodoc classifies inherited staticmethods as regular methods
51+
* #4472: DOCUMENTATION_OPTIONS is not defined
5152

5253
Testing
5354
--------

sphinx/ext/doctest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import sys
1616
import time
1717
import codecs
18-
import platform
1918
from os import path
2019
import doctest
2120

@@ -144,7 +143,8 @@ def run(self):
144143
if self.name == 'doctest' and 'pyversion' in self.options:
145144
try:
146145
spec = self.options['pyversion']
147-
if not is_allowed_version(spec, platform.python_version()):
146+
python_version = '.'.join(str(v) for v in sys.version_info[:3])
147+
if not is_allowed_version(spec, python_version):
148148
flag = doctest.OPTIONFLAGS_BY_NAME['SKIP']
149149
node['options'][flag] = True # Skip the test
150150
except InvalidSpecifier:

sphinx/util/inspect.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ def format_annotation(self, annotation):
453453

454454
if annotation.__module__ == 'builtins':
455455
return annotation.__qualname__ # type: ignore
456-
elif isinstance(annotation, typing.GenericMeta):
456+
elif (hasattr(typing, 'GenericMeta') and # for py36 or below
457+
isinstance(annotation, typing.GenericMeta)):
457458
# In Python 3.5.2+, all arguments are stored in __args__,
458459
# whereas __parameters__ only contains generic parameters.
459460
#
@@ -480,7 +481,8 @@ def format_annotation(self, annotation):
480481
if params is not None:
481482
param_str = ', '.join(self.format_annotation(p) for p in params)
482483
return '%s[%s]' % (qualified_name, param_str)
483-
elif (isinstance(annotation, typing.CallableMeta) and # type: ignore
484+
elif (hasattr(typing, 'CallableMeta') and # for py36 or below
485+
isinstance(annotation, typing.CallableMeta) and # type: ignore
484486
getattr(annotation, '__args__', None) is not None and
485487
hasattr(annotation, '__result__')):
486488
# Skipped in the case of plain typing.Callable
@@ -495,7 +497,8 @@ def format_annotation(self, annotation):
495497
return '%s[%s, %s]' % (qualified_name,
496498
args_str,
497499
self.format_annotation(annotation.__result__))
498-
elif (isinstance(annotation, typing.TupleMeta) and # type: ignore
500+
elif (hasattr(typing, 'TupleMeta') and # for py36 or below
501+
isinstance(annotation, typing.TupleMeta) and # type: ignore
499502
hasattr(annotation, '__tuple_params__') and
500503
hasattr(annotation, '__tuple_use_ellipsis__')):
501504
params = annotation.__tuple_params__

tests/test_ext_math.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import os
1313
import re
14+
import errno
1415
import subprocess
1516

1617
import pytest
@@ -20,7 +21,7 @@ def has_binary(binary):
2021
try:
2122
subprocess.check_output([binary])
2223
except OSError as e:
23-
if e.errno == os.errno.ENOENT:
24+
if e.errno == errno.ENOENT:
2425
# handle file not found error.
2526
return False
2627
else:

tests/test_util_inspect.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,12 @@ def test_Signature_annotations():
215215

216216
# TypeVars and generic types with TypeVars
217217
sig = inspect.Signature(f2).format_args()
218-
assert sig == '(x: List[T], y: List[T_co], z: T) -> List[T_contra]'
218+
if sys.version_info < (3, 7):
219+
sig == ('(x: typing.List[T], y: typing.List[T_co], z: T) -> '
220+
'typing.List[T_contra]')
221+
else:
222+
sig == ('(x: typing.List[~T], y: typing.List[+T_co], z: T) -> '
223+
'typing.List[-T_contra]')
219224

220225
# Union types
221226
sig = inspect.Signature(f3).format_args()

0 commit comments

Comments
 (0)