New submission from hongweipeng <hongweichen8...@sina.com>:
root@debian:/workspace/cpython# ./python Python 3.11.0a3+ (heads/main-dirty:b123ad8030, Dec 16 2021, 06:16:15) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import inspect >>> class Foo: ... def __getattr__(self, attr): ... return None ... >>> inspect.getmembers(Foo()) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/workspace/cpython/Lib/inspect.py", line 488, in getmembers return _getmembers(object, predicate, getattr) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspace/cpython/Lib/inspect.py", line 455, in _getmembers for base in object.__bases__: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'NoneType' object is not iterable ---------- components: Library (Lib) messages: 408717 nosy: hongweipeng priority: normal severity: normal status: open title: inspect.getmembers will call the instance __bases__ attribute, which may cause an exception type: behavior versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46103> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com