diff options
Diffstat (limited to 'sphinx/util/docfields.py')
-rw-r--r-- | sphinx/util/docfields.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sphinx/util/docfields.py b/sphinx/util/docfields.py index 1e8596e5b..dd9854ce6 100644 --- a/sphinx/util/docfields.py +++ b/sphinx/util/docfields.py @@ -218,7 +218,14 @@ class DocFieldTransformer: def __init__(self, directive: "ObjectDescription") -> None: self.directive = directive - self.typemap = directive.get_field_type_map() + + try: + self.typemap = directive.get_field_type_map() + except Exception: + # for 3rd party extensions directly calls this transformer. + warnings.warn('DocFieldTransformer expects given directive object is a subclass ' + 'of ObjectDescription.', RemovedInSphinx40Warning) + self.typemap = self.preprocess_fieldtypes(directive.__class__.doc_field_types) def preprocess_fieldtypes(self, types: List[Field]) -> Dict[str, Tuple[Field, bool]]: warnings.warn('DocFieldTransformer.preprocess_fieldtypes() is deprecated.', |