diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-02-15 19:35:29 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-02-15 19:35:29 +0300 |
commit | b29ee3ded00de1d3ddc6547b171f091374a71e47 (patch) | |
tree | c87e8181f4baabcd38814d5f7500c9200f3e75d0 /sphinx/ext/autodoc | |
parent | 633c5ad9c6f4511e3016dd451f17ace1ad160fb2 (diff) |
Fix #8883: autodoc: AttributeError on assigning __annotations__
Diffstat (limited to 'sphinx/ext/autodoc')
-rw-r--r-- | sphinx/ext/autodoc/__init__.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index dc413b5c2..3ae6dff75 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -1394,7 +1394,7 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ params[0] = params[0].replace(annotation=typ) try: func.__signature__ = sig.replace(parameters=params) # type: ignore - except TypeError: + except (AttributeError, TypeError): # failed to update signature (ex. built-in or extension types) return @@ -2177,7 +2177,7 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter): # type: params[1] = params[1].replace(annotation=typ) try: func.__signature__ = sig.replace(parameters=params) # type: ignore - except TypeError: + except (AttributeError, TypeError): # failed to update signature (ex. built-in or extension types) return @@ -2443,7 +2443,7 @@ class AttributeDocumenter(GenericAliasMixin, NewTypeMixin, SlotsMixin, # type: annotations[attrname] = annotation except (AttributeError, PycodeError): pass - except TypeError: + except (AttributeError, TypeError): # Failed to set __annotations__ (built-in, extensions, etc.) pass |