mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #8092 from tk0miya/8085_AttributeError_on_get_type_hints
Fix #8091: autodoc: AttributeError is raised on documenting an attribute
This commit is contained in:
commit
e70a30e5a3
2
CHANGES
2
CHANGES
@ -40,6 +40,8 @@ Bugs fixed
|
|||||||
* #8074: napoleon: Crashes during processing C-ext module
|
* #8074: napoleon: Crashes during processing C-ext module
|
||||||
* #8084: autodoc: KeyError is raised on documenting an attribute of the broken
|
* #8084: autodoc: KeyError is raised on documenting an attribute of the broken
|
||||||
class
|
class
|
||||||
|
* #8091: autodoc: AttributeError is raised on documenting an attribute on Python
|
||||||
|
3.5.2
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -1613,6 +1613,9 @@ class DataDocumenter(ModuleLevelDocumenter):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
# a broken class found (refs: https://github.com/sphinx-doc/sphinx/issues/8084)
|
# a broken class found (refs: https://github.com/sphinx-doc/sphinx/issues/8084)
|
||||||
annotations = {}
|
annotations = {}
|
||||||
|
except AttributeError:
|
||||||
|
# AttributeError is raised on 3.5.2 (fixed by 3.5.3)
|
||||||
|
annotations = {}
|
||||||
|
|
||||||
if self.objpath[-1] in annotations:
|
if self.objpath[-1] in annotations:
|
||||||
objrepr = stringify_typehint(annotations.get(self.objpath[-1]))
|
objrepr = stringify_typehint(annotations.get(self.objpath[-1]))
|
||||||
@ -1986,6 +1989,9 @@ class AttributeDocumenter(DocstringStripSignatureMixin, ClassLevelDocumenter):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
# a broken class found (refs: https://github.com/sphinx-doc/sphinx/issues/8084)
|
# a broken class found (refs: https://github.com/sphinx-doc/sphinx/issues/8084)
|
||||||
annotations = {}
|
annotations = {}
|
||||||
|
except AttributeError:
|
||||||
|
# AttributeError is raised on 3.5.2 (fixed by 3.5.3)
|
||||||
|
annotations = {}
|
||||||
|
|
||||||
if self.objpath[-1] in annotations:
|
if self.objpath[-1] in annotations:
|
||||||
objrepr = stringify_typehint(annotations.get(self.objpath[-1]))
|
objrepr = stringify_typehint(annotations.get(self.objpath[-1]))
|
||||||
|
Loading…
Reference in New Issue
Block a user