mkapi
mkapi copied to clipboard
Use try-except instead of hasattr for detection of __wrapped__ and __pytest_wrapped__
https://github.com/daizutabi/mkapi/blob/6e0cf8f43adf1d5fe9008b751714817e694f88e3/mkapi/core/object.py#L201-L203
When some classes have improper or complicated __getattr__ implemented, this will raise some errors unexpectedly.
We should use try-except instead:
try:
obj.__wrapped__
# Do something with obj.__wrapped__
# or in else
except AttributeError:
# no __wrapped__ attribute