Author levkivskyi
Recipients Oleg.Oleinik, levkivskyi, tuxtimo
Date 2018-05-31.17:58:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527789531.25.0.682650639539.issue33668@psf.upfronthosting.co.za>
In-reply-to
Content
Hm, replacing the return with a random string, this leads to another crash:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ilevkivskyi/src/cpython/Lib/_sitebuiltins.py", line 103, in __call__
    return pydoc.help(*args, **kwds)
  File "/Users/ilevkivskyi/src/cpython/Lib/pydoc.py", line 1895, in __call__
    self.help(request)
  File "/Users/ilevkivskyi/src/cpython/Lib/pydoc.py", line 1954, in help
    else: doc(request, 'Help on %s:', output=self._output)
  File "/Users/ilevkivskyi/src/cpython/Lib/pydoc.py", line 1674, in doc
    pager(render_doc(thing, title, forceload))
  File "/Users/ilevkivskyi/src/cpython/Lib/pydoc.py", line 1667, in render_doc
    return title % desc + '\n\n' + renderer.document(object, name)
  File "/Users/ilevkivskyi/src/cpython/Lib/pydoc.py", line 385, in document
    if inspect.ismodule(object): return self.docmodule(*args)
  File "/Users/ilevkivskyi/src/cpython/Lib/pydoc.py", line 1157, in docmodule
    for importer, modname, ispkg in pkgutil.iter_modules(object.__path__):
  File "/Users/ilevkivskyi/src/cpython/Lib/pkgutil.py", line 123, in iter_modules
    raise ValueError("path must be None or list of paths to look for "
ValueError: path must be None or list of paths to look for modules in

The reason is that `__getattr__` is also triggered when a special attribute is looked up. I am not sure what to do with this. This is a bit inconsistent with how classes behave, where e.g. `__len__` is never searched on an instance. But modules are special in many other ways, so maybe we can just fix pydoc (and other tools like inspect) to expect some ill-typed values in special module attributes and fail gracefully?
History
Date User Action Args
2018-05-31 17:58:51levkivskyisetrecipients: + levkivskyi, tuxtimo, Oleg.Oleinik
2018-05-31 17:58:51levkivskyisetmessageid: <1527789531.25.0.682650639539.issue33668@psf.upfronthosting.co.za>
2018-05-31 17:58:51levkivskyilinkissue33668 messages
2018-05-31 17:58:51levkivskyicreate