Skip to content

Commit 0281755

Browse files
basnijholtgaborbernat
authored andcommitted
Revert "skip type annotations for 3.7, which fails for unknown reasons"
This reverts commit 59c3f83.
1 parent f5ab7ae commit 0281755

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

sphinx_autodoc_typehints.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,8 @@ def _is_dataclass(name: str, what: str, qualname: str) -> bool:
265265

266266

267267
def _future_annotations_imported(obj):
268-
if sys.version_info < (3, 8):
269-
# Only Python ≥ 3.7 supports PEP563, however
270-
# Python 3.7 doesn't give the expected results.
271-
# TODO: make it work for Python 3.7.
268+
if sys.version_info < (3, 7):
269+
# Only Python ≥ 3.7 supports PEP563.
272270
return False
273271

274272
_annotations = getattr(inspect.getmodule(obj), "annotations", None)

tests/test_sphinx_autodoc_typehints.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,7 @@ def test_sphinx_output(app, status, warning, always_document_param_types):
266266

267267
app.config.always_document_param_types = always_document_param_types
268268
app.config.autodoc_mock_imports = ['mailbox']
269-
if sys.version_info < (3, 8):
270-
# TODO: fix for Python 3.7
269+
if sys.version_info < (3, 7):
271270
app.config.autodoc_mock_imports.append('dummy_module_future_annotations')
272271
app.build()
273272

@@ -560,8 +559,7 @@ class dummy_module.DataClass(x)
560559
assert text_contents == maybe_fix_py310(expected_contents)
561560

562561

563-
# TODO: fix for Python 3.7, which *should* work but fails for unknown reasons
564-
@pytest.mark.skipif(sys.version_info < (3, 8),
562+
@pytest.mark.skipif(sys.version_info < (3, 7),
565563
reason="Future annotations are not implemented in Python < 3.7")
566564
@pytest.mark.sphinx('text', testroot='dummy')
567565
@patch('sphinx.writers.text.MAXWIDTH', 2000)

0 commit comments

Comments
 (0)