srusskih / SublimeJEDI

awesome Python autocompletion with SublimeText
MIT License
938 stars 109 forks source link

[BUG]When I set a global variable in my code,then jedi will crash #270

Closed yllgl closed 6 years ago

yllgl commented 6 years ago

my code is as follows: global variable_a variable_a=[] variable_a.append(somthing)

when I typed variable_a.append, Then "plugin_host has exited unexpectedly, plugin functionality won't be available until Sublime Text has been restarted" will occured. I don't know why.

My Jedi version is v0.13.4. And windows 10 64bit st3 Build 3176

srusskih commented 6 years ago

duplication #257

srusskih commented 6 years ago
# test_script.py
import sys
import jedi
from jedi.api import environment

source = '''
global variable_a
variable_a=[]
variable_a.append('''

def comp():
    python_interpreter = '/usr/local/bin/python3'  # sys.argv[1]
    env = environment.Environment(
        environment._get_python_prefix(python_interpreter),
        python_interpreter)

    script = jedi.Script(
        source,
        4, len('variable_a.append('),
        'some.py',
        environment=env)
    return (script.completions(), script.call_signatures())

print(comp())

python test_script.py

  File "/Users/sr/.virtualenvs/jedi-experiments/lib/python2.7/site-packages/parso/python/tree.py", line 980, in type
    return '%s_stmt' % self.keyword
RuntimeError: maximum recursion depth exceeded