mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #5345 from tk0miya/fix_autodoc_fox_py351
autodoc: Fix typing.get_type_hints() raises AttributeError for partial objects
This commit is contained in:
commit
6e8113da36
@ -360,7 +360,12 @@ class Signature(object):
|
|||||||
try:
|
try:
|
||||||
self.annotations = typing.get_type_hints(subject) # type: ignore
|
self.annotations = typing.get_type_hints(subject) # type: ignore
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.warning('Invalid type annotation found on %r. Ingored: %r', subject, exc)
|
if (3, 5, 0) <= sys.version_info < (3, 5, 3) and isinstance(exc, AttributeError):
|
||||||
|
# python 3.5.2 raises ValueError for partial objects.
|
||||||
|
self.annotations = {}
|
||||||
|
else:
|
||||||
|
logger.warning('Invalid type annotation found on %r. Ingored: %r',
|
||||||
|
subject, exc)
|
||||||
self.annotations = {}
|
self.annotations = {}
|
||||||
|
|
||||||
if bound_method:
|
if bound_method:
|
||||||
|
Loading…
Reference in New Issue
Block a user