1
0
forked from VimPlug/jedi

Try to use the return annotations of properties, if available, fixes #1933

This commit is contained in:
Dave Halter
2023-07-28 22:35:07 +02:00
parent ff3a7f367f
commit 886279fb6d
3 changed files with 60 additions and 2 deletions

View File

@@ -354,7 +354,7 @@ class DirectObjectAccess:
if is_get_descriptor and type(attr) not in ALLOWED_DESCRIPTOR_ACCESS:
if isinstance(attr, property):
if hasattr(attr.fget, '__annotations__'):
a = DirectObjectAccess(self._inference_state, attr)
a = DirectObjectAccess(self._inference_state, attr.fget)
return True, True, a.get_return_annotation()
# In case of descriptors that have get methods we cannot return
# it's value, because that would mean code execution.