use __qualname__ to compute bound method repr (closes #21389)

Patch from Steven Barker.