Conversation
Fixes bug where an `AttributeError` raised in the `__get__` of an exposed descriptor `exposed_foo` was only being propagated correctly to the client if the client accessed the exposed descriptor as `conn.root.exposed_foo` rather than as `conn.root.foo`.
|
Sorry for the slow response time! I think my only gripe would be potential performance implications of try-except blocks. Typically try-except has a higher overhead than if else statement. Do you think it would be possible to change to a if-else logic flow? |
|
Hi, and sorry for the delay! Considering try-catch overhead makes sense. The try-catch cost can be avoided in the common case if we As far as I can tell, the only way to rewrite I've also rebased onto master to resolve the conflict. |
Closes #478.
This uses
inspect.getattr_staticto avoid triggering the descriptor lookup thathasattrusually triggers. The logic also needs a fallback tohasattrsincegetattr_static"may not be able to retrieve all attributes thatgetattrcan fetch (like dynamically created attributes)".Per the docs,
getattr_static"may find attributes thatgetattrcan’t (like descriptors that raiseAttributeError)". I am not aware of any edge cases wherehasattrwill return False but wheregetattr_staticwill succeed without raising anAttributeError(although I did not not dive into CPython'sgetattr_staticimplementation to look for such cases), but perhaps there is some edge case that makes usinggetattr_statica bad choice here. If you know of a better way to fix #478 please let me know :)I was a bit liberal with adding the tests for multiple configs since the runtime it adds is negligible and extra safety is good. I also slightly broke PEP 8 line length in the tests I added—please change my code style if RPyC uses a different style :)