ncm2 / ncm2-jedi

MIT License
23 stars 11 forks source link

Recursion error on completion #27

Closed bo5o closed 4 years ago

bo5o commented 4 years ago

When you try to complete on a stdlib module, a recursion error occurs.

Minimal Example

import os

os.get<trigger completion>

Error traceback

...
[ncm2_jedi@yarp]     doc += name.py__doc__()
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/names.py", line 634, in py__doc__
[ncm2_jedi@yarp]     return _merge_name_docs(names)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/names.py", line 22, in _merge_name_docs
[ncm2_jedi@yarp]     doc += name.py__doc__()
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/names.py", line 236, in py__doc__
[ncm2_jedi@yarp]     return _merge_name_docs(names)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/names.py", line 22, in _merge_name_docs
[ncm2_jedi@yarp]     doc += name.py__doc__()
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/names.py", line 634, in py__doc__
[ncm2_jedi@yarp]     return _merge_name_docs(names)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/names.py", line 22, in _merge_name_docs
[ncm2_jedi@yarp]     doc += name.py__doc__()
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/names.py", line 236, in py__doc__
[ncm2_jedi@yarp]     return _merge_name_docs(names)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/names.py", line 22, in _merge_name_docs
[ncm2_jedi@yarp]     doc += name.py__doc__()
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/names.py", line 628, in py__doc__
[ncm2_jedi@yarp]     names = convert_names(names, prefer_stub_to_compiled=False)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/gradual/conversion.py", line 141, in convert_names
[ncm2_jedi@yarp]     names, prefer_stub_to_compiled=prefer_stub_to_compiled)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/utils.py", line 20, in wrapper
[ncm2_jedi@yarp]     return list(func(*args, **kwargs))
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/gradual/conversion.py", line 63, in _try_stub_to_python_names
[ncm2_jedi@yarp]     values = convert_values(name.infer(), ignore_compiled=prefer_stub_to_compiled)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/gradual/conversion.py", line 157, in convert_values
[ncm2_jedi@yarp]     for stub_value in values
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/common/value.py", line 32, in from_sets
[ncm2_jedi@yarp]     for set_ in sets:
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/gradual/conversion.py", line 157, in <genexpr>
[ncm2_jedi@yarp]     for stub_value in values
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/gradual/conversion.py", line 28, in _stub_to_python_value_set
[ncm2_jedi@yarp]     values = _infer_from_stub(stub_module_context, qualified_names, ignore_compiled)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/gradual/conversion.py", line 50, in _infer_from_stub
[ncm2_jedi@yarp]     non_stubs = non_stubs.py__getattribute__(name)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/base_value.py", line 395, in py__getattribute__
[ncm2_jedi@yarp]     return ValueSet.from_sets(c.py__getattribute__(*args, **kwargs) for c in self._set)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/common/value.py", line 32, in from_sets
[ncm2_jedi@yarp]     for set_ in sets:
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/base_value.py", line 395, in <genexpr>
[ncm2_jedi@yarp]     return ValueSet.from_sets(c.py__getattribute__(*args, **kwargs) for c in self._set)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/base_value.py", line 88, in py__getattribute__
[ncm2_jedi@yarp]     names = self.goto(name_or_str, name_context, analysis_errors)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/base_value.py", line 77, in goto
[ncm2_jedi@yarp]     names = finder.filter_name(filters, name_or_str)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/finder.py", line 36, in filter_name
[ncm2_jedi@yarp]     names = filter.get(string_name)
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/filters.py", line 240, in get
[ncm2_jedi@yarp]     return [n for filter in self._filters for n in filter.get(name)]
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/filters.py", line 240, in <listcomp>
[ncm2_jedi@yarp]     return [n for filter in self._filters for n in filter.get(name)]
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/filters.py", line 82, in get
[ncm2_jedi@yarp]     _get_definition_names(self._used_names, name),
[ncm2_jedi@yarp]   File "~/.pyenv/versions/py3nvim/lib/python3.7/site-packages/jedi/inference/filters.py", line 57, in _get_definition_names
[ncm2_jedi@yarp]     for_module = _definition_name_cache[used_names]
[ncm2_jedi@yarp]   File "~/.pyenv/versions/3.7.6/lib/python3.7/weakref.py", line 396, in __getitem__
[ncm2_jedi@yarp]     return self.data[ref(key)]
[ncm2_jedi@yarp] RecursionError: maximum recursion depth exceeded

health#jedi#check

jedi

Jedi-vim debug information

jedi-vim version
Global Python

Using Python version 3 to access Jedi.

Jedi
Jedi environment: <SameEnvironment: 3.7.6 in /home/bosdch1/.pyenv/versions/py3nvim>
Known environments
Settings
g:jedi#goto_stubs_command = '' (default: '<leader>s')
g:jedi#usages_command = 'gr' (default: '<leader>n')
g:jedi#completions_command = '' (default: '<C-Space>')
g:jedi#rename_command = '<leader>rn' (default: '<leader>r')
g:jedi#goto_assignments_command = '' (default: '<leader>g')
g:jedi#goto_command = 'gd' (default: '<leader>d')
g:jedi#completions_enabled = 0 (default: 1)

health#provider#check

Clipboard (optional)

Python 2 provider (optional)

Python 3 provider (optional)

Python virtualenv

Output of :version

NVIM v0.5.0-363-g31614d3eb
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-5 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-pr
ototypes -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/
travis/build/neovim/bot-ci/build/neovim/build/config -I/home/travis/build/neovim/bot-ci/build/neovim/src -I/home/travis/build/neovim/bot-ci/build/neovim/.deps/usr/include -I/usr/include -I/ho
me/travis/build/neovim/bot-ci/build/neovim/build/src/nvim/auto -I/home/travis/build/neovim/bot-ci/build/neovim/build/include
Compiled by travis@travis-job-42ac83d1-057a-458c-bd3f-e8353b2ab058

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/home/travis/build/neovim/bot-ci/build/neovim/build/nvim.AppDir/usr/share/nvim"
joncinque commented 4 years ago

I was having this issue too, looks like it was fixed on the jedi side in https://github.com/davidhalter/jedi/issues/1490 -- they haven't issued a new release recently, but the issue is resolved if you use the package directly from master:

pip3 install -e git://github.com/davidhalter/jedi.git#egg=jedi