From c01dedeaa3c6b077cd96f6718362e39f69c4ccbd 2023-04-05 16:58:35 From: Erik Welch Date: 2023-04-05 16:58:35 Subject: [PATCH] Don't do truthy check on object; use `is not None` For example, without this change, doing `df.merge?` on a pandas DataFrame currently fails, because `df.__bool__()` raises an exception. --- diff --git a/IPython/core/oinspect.py b/IPython/core/oinspect.py index 83aada8..0b8b2b8 100644 --- a/IPython/core/oinspect.py +++ b/IPython/core/oinspect.py @@ -835,7 +835,7 @@ class Inspector(Colorable): att_name = oname.split(".")[-1] parents_docs = None prelude = "" - if info and info.parent and hasattr(info.parent, HOOK_NAME): + if info and info.parent is not None and hasattr(info.parent, HOOK_NAME): parents_docs_dict = getattr(info.parent, HOOK_NAME) parents_docs = parents_docs_dict.get(att_name, None) out = dict(