Closed johnklee closed 1 year ago
This impl is intentional as the docstring explained.
Thanks for the reply. I understand the docstring of __getattr__
:
"""Tries to return a snippet client registered with `name`.
This is for backward compatibility of direct accessing snippet clients.
"""
however, I did observe RecursionError
from myside and it is happened when self.services
is not available. But I do observe that self.services
has been initialized in constructor of class AndroidDevice
. So the issue here is trying to avoid RecursionError
which it is hard for debugging and it will be a good idea to improve it by using exception for more information. FYI
Sure, but the proposed solution breaks existing behavior. So we'd rather bite this bullet than having it not working at all.
Understood! Thanks for the response. The issue is confirmed to be the misuse of class AndroidDevice
from our implementation. Normally it won't happen or encounter by other users. So feel free to close this issue and thanks for your patience and time here. By the way, the proposed solution is optional and it can be improved to both throw more informative exception and keep existing behavior if we want. Thanks!
From
android_device.py
at line 1,114:it will cause exception RecursionError when
self.services
does not exist for somehow and we try to access an attribute not exist in android device object. Take below sample code for example:So if we execute above test script:
So the proposed implementation for getattr is: