Author Oleg.Oleinik
Recipients Oleg.Oleinik
Date 2018-05-28.14:22:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I write file
def __getattr__(key):
    return None

when I try to run it I've got error:
Traceback (most recent call last):
  File "", line 5, in <module>
  File "C:\Program Files\Python37\lib\", line 103, in __call__
    return*args, **kwds)
  File "C:\Program Files\Python37\lib\", line 1894, in __call__
  File "C:\Program Files\Python37\lib\", line 1944, in help
    elif request: doc(request, 'Help on %s:', output=self._output)
  File "C:\Program Files\Python37\lib\", line 1674, in doc
    pager(render_doc(thing, title, forceload))
  File "C:\Program Files\Python37\lib\", line 1667, in render_doc
    return title % desc + '\n\n' + renderer.document(object, name)
  File "C:\Program Files\Python37\lib\", line 385, in document
    if inspect.ismodule(object): return self.docmodule(*args)
  File "C:\Program Files\Python37\lib\", line 1136, in docmodule
    for key, value in inspect.getmembers(object, inspect.isclass):
  File "C:\Program Files\Python37\lib\", line 330, in getmembers
    for base in object.__bases__:
TypeError: 'NoneType' object is not iterable

If I change definition of __getattr__ function to:
def __getattr__(key):
   raise AttributeError()
then help function runs without errors. But I need to return None value from __getattr__ function.
When I wrote this function in class definition there is also no errors during runtime
Date User Action Args
2018-05-28 14:22:23Oleg.Oleiniksetrecipients: + Oleg.Oleinik
2018-05-28 14:22:23Oleg.Oleiniksetmessageid: <>
2018-05-28 14:22:23Oleg.Oleiniklinkissue33668 messages
2018-05-28 14:22:23Oleg.Oleinikcreate