##// END OF EJS Templates
Backport PR #14004: Don't do truthy check on object; use `is not None`
Matthias Bussonnier -
Show More
@@ -835,7 +835,7 b' class Inspector(Colorable):'
835 att_name = oname.split(".")[-1]
835 att_name = oname.split(".")[-1]
836 parents_docs = None
836 parents_docs = None
837 prelude = ""
837 prelude = ""
838 if info and info.parent and hasattr(info.parent, HOOK_NAME):
838 if info and info.parent is not None and hasattr(info.parent, HOOK_NAME):
839 parents_docs_dict = getattr(info.parent, HOOK_NAME)
839 parents_docs_dict = getattr(info.parent, HOOK_NAME)
840 parents_docs = parents_docs_dict.get(att_name, None)
840 parents_docs = parents_docs_dict.get(att_name, None)
841 out = dict(
841 out = dict(
@@ -370,6 +370,23 b' def cleanup_user_ns(**kwargs):'
370 del ip.user_ns[k]
370 del ip.user_ns[k]
371
371
372
372
373 def test_pinfo_bool_raise():
374 """
375 Test that bool method is not called on parent.
376 """
377
378 class RaiseBool:
379 attr = None
380
381 def __bool__(self):
382 raise ValueError("pinfo should not access this method")
383
384 raise_bool = RaiseBool()
385
386 with cleanup_user_ns(raise_bool=raise_bool):
387 ip._inspect("pinfo", "raise_bool.attr", detail_level=0)
388
389
373 def test_pinfo_getindex():
390 def test_pinfo_getindex():
374 def dummy():
391 def dummy():
375 """
392 """
General Comments 0
You need to be logged in to leave comments. Login now