Issue 23825: test_idle fails under -OO (original) (raw)

The relevant code in CallTips.py itself

if isinstance(ob_call, types.MethodType):
    doc = ob_call.__doc__
else:
    doc = getattr(ob, "__doc__", "")
if doc: <add more to calltip>

equally ignores both None and '', but I forgot the None possibility in the tests. I cannot test the patch, but the fix looks right. Putting the doc conditional expression before the for loops works because if one .doc is set to None, all are. For the same reason, doc could be defined as a global name, but if the patch makes test_idle pass, it is fine as it is.