mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #8883: autodoc: AttributeError on assigning __annotations__
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -16,6 +16,8 @@ Features added
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
* #8883: autodoc: AttributeError is raised on assigning __annotations__ on
|
||||
read-only class
|
||||
* #8884: html: minified js stemmers not included in the distributed package
|
||||
* #8880: viewcode: ExtensionError is raised on incremental build after
|
||||
unparsable python module found
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user