[New-bugs-announce] [issue46103] inspect.getmembers will call the instance __bases__ attribute, which may cause an exception
hongweipeng
report at bugs.python.org
Thu Dec 16 10:40:43 EST 2021
New submission from hongweipeng <hongweichen8888 at sina.com>:
root at 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 <report at bugs.python.org>
<https://bugs.python.org/issue46103>
_______________________________________
More information about the New-bugs-announce
mailing list