File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed
src/sphinx_codeautolink/extension Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ This release changes an internal API.
14
14
Please delete the cache file before building documentation.
15
15
16
16
- Link import statements (:issue: `42 `)
17
+ - Gracefully handle functions that don't have an annotations dict (:issue: `47 `)
17
18
- Enable configurations without autodoc (:issue: `48 `)
18
19
- Support custom code block syntax (:issue: `49 `)
19
20
- Fix crash on annotation-only assignment (:issue: `50 `)
Original file line number Diff line number Diff line change @@ -41,7 +41,8 @@ def locate_type(components: Tuple[str]) -> Optional[str]:
41
41
# A possible function / method call needs to be last in the chain.
42
42
# Otherwise we might follow return types on function attribute access.
43
43
elif callable (value ) and i == len (remaining ) - 1 :
44
- ret_annotation = value .__annotations__ .get ('return' , None )
44
+ annotations = getattr (value , '__annotations__' , {})
45
+ ret_annotation = annotations .get ('return' , None )
45
46
46
47
# Inner type from typing.Optional (Union[T, None])
47
48
origin = getattr (ret_annotation , '__origin__' , None )
You can’t perform that action at this time.
0 commit comments