Improve the exc:TypeError message for non-string second arguments passed to the built-in functions getattr and hasattr. Patch by Géry Ogam.