Issue #25590: Make rlcompleter only call getattr() once per attribute

Previously it was called another time via hasattr(), and both calls were
made once for dir(f) and again for dir(f.__class__).  This includes a
backport of changing from a list to a set from revision 4dbb315fe667.
3 files changed