#14638: pydoc now treats non-str __name__ as None instead of raising

Original patch by Peter Otten.
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 674af6a..68ba21f 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1498,7 +1498,8 @@
             raise ImportError, 'no Python documentation found for %r' % thing
         return object, thing
     else:
-        return thing, getattr(thing, '__name__', None)
+        name = getattr(thing, '__name__', None)
+        return thing, name if isinstance(name, str) else None
 
 def render_doc(thing, title='Python Library Documentation: %s', forceload=0):
     """Render text documentation, given an object or a path to an object."""