Open zerocewl opened 3 weeks ago
The problem is probably that the attribute on helloworld.MyClass.my_func'
might just be an alias to abs
or whatever builtin function. I'm not sure we have the information on the object (on classes we do). We could probably change the default there. But this is all highly complicated, because for a lot of these things we are talking about heuristics.
hm that sounds not very promising =)
There is no easy solution where we can adapt the criterion if the node is a class function? For other functions the completion is working fine...
I only found during debugging in getattr_static that at some point a __get__
is checked and found for the function, but i don't know why this should be the check.
Another nasty workaround could be the change of /jedi/inference/compiled/access.py#L354 by adding a check like type(attr).__name__ != "cython_function_or_method"
:
if is_get_descriptor and type(attr) not in ALLOWED_DESCRIPTOR_ACCESS and type(attr).__name__ != "cython_function_or_method":
First things first: Thx for creating and maintaining jedi!
I have an issue with completing compiled files, created with cython but only with methods / functions inside classes. If i try to complete these methods they are shown as
builtins
and not as function, in fact all infos likedocstring
are missing too.To reproduce the issue i used a simple python class (the static function is only to show, that this one works):
Following the simple
hello world
example from Cython i created the so file / compiled withpython setup.py build_ext --inplace
After this i tried to create the completion with the minimal changed jedi example:
But the completion from the first entry returns
module_name
asbuiltins
.I also create a small pytest to assert the completion, but only with the already created compiled file:
I tried to debug
inference/compiled
and only found a very rough workaround by setting theis_get_descriptor
inaccess.py
#L335 toFalse
. So maybe the return value fromattr, is_get_descriptor = getattr_static(self._obj, name)
is not as expected for this case?Here is a screenshot from the pytest, showing the wrong content for the completion.
Note: Static functions inside classes works as expected.
I used python
3.11.10
on arm mac (the issue is on windows reproducible too).