[issue35108] inspect.getmembers passes exceptions from object's properties through

Karthikeyan Singaravelan report at bugs.python.org
Tue Oct 30 05:47:22 EDT 2018


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

Thanks for the report. A simple reproducible in Python without splinter code. I think it happens for instances of the class where the attribute is a property raising exception and executing inspect.getmembers(Foo) works fine.

# bpo35108.py

import inspect

class Foo():

    @property
    def bar(self):
        raise NotImplementedError

print(inspect.getmembers(Foo()))

$. /python.exe ../backups/bpo35108.py
Traceback (most recent call last):
  File "../backups/bpo35108.py", line 9, in <module>
    print(inspect.getmembers(Foo()))
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/inspect.py", line 344, in getmembers
    value = getattr(object, key)
  File "../backups/bpo35108.py", line 7, in bar
    raise NotImplementedError
NotImplementedError

----------
nosy: +xtreak

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35108>
_______________________________________


More information about the Python-bugs-list mailing list