Skip to content

Commit

Permalink
Backport PR ipython#14011: Raise an ImportError if docstrings should …
Browse files Browse the repository at this point in the history
…be sphinxified, but docrepr is't available
  • Loading branch information
Carreau authored and meeseeksmachine committed Apr 28, 2023
1 parent 3a48cf4 commit 5314890
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 5314890

Please sign in to comment.