Skip to content

Commit

Permalink
Raise an ImportError if docstrings should be sphinxified, but docrepr…
Browse files Browse the repository at this point in the history
… isn't available.
  • Loading branch information
doerwalter authored and Carreau committed Apr 21, 2023
1 parent 47d043e commit 3ad4cd9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions IPython/core/interactiveshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -1781,9 +1781,12 @@ def _inspect(self, meth, oname, namespaces=None, **kw):
This function is meant to be called by pdef, pdoc & friends.
"""
info: OInfo = self._object_find(oname, namespaces)
docformat = (
sphinxify(self.object_inspect(oname)) if self.sphinxify_docstring else None
)
if self.sphinxify_docstring:
if sphinxify is None:
raise ImportError("Module ``docrepr`` required but missing")
docformat = sphinxify(self.object_inspect(oname))
else:
docformat = None
if info.found or hasattr(info.parent, oinspect.HOOK_NAME):
pmethod = getattr(self.inspector, meth)
# TODO: only apply format_screen to the plain/text repr of the mime
Expand Down

0 comments on commit 3ad4cd9

Please sign in to comment.