You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 like docstring are missing too.
To reproduce the issue i used a simple python class (the static function is only to show, that this one works):
classMyClass:
defmy_function(self):
print('hello from function2')
@staticmethoddefmy_function_static():
print('hello from static function')
Following the simple hello world example from Cython i created the so file / compiled with
python setup.py build_ext --inplace
After this i tried to create the completion with the minimal changed jedi example:
I tried to debug inference/compiled and only found a very rough workaround by setting the is_get_descriptor in access.py#L335 to False. So maybe the return value from
attr, 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).
❯ pip list
Package Version
---------- -------
Cython 3.0.11
jedi 0.19.1
parso 0.8.4
pip 24.2
setuptools 74.1.2
The text was updated successfully, but these errors were encountered:
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.
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":
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).The text was updated successfully, but these errors were encountered: