Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion crash on global variables #1228

Closed
ppwwyyxx opened this issue Oct 2, 2018 · 1 comment
Closed

Completion crash on global variables #1228

ppwwyyxx opened this issue Oct 2, 2018 · 1 comment

Comments

@ppwwyyxx
Copy link

ppwwyyxx commented Oct 2, 2018

#File: mymodule.py
def func():
    global a
    a = 1
import os
import time
from jedi import Script
source = r"""
#!/usr/bin/env python
import mymodule
mymodule.""".strip()
lines = source.strip().split('\n')

ret = Script(source, len(lines), len(lines[-1]), None).completions()

The completion crashes with the error:

Traceback (most recent call last):
  File "a.py", line 14, in <module>
    ret = Script(source, len(lines), len(lines[-1]), None).completions()
  File "/home/XXX/.local/lib/python3.6/site-packages/jedi/api/__init__.py", line 182, in completions                                                                                           
    c for c in completions
  File "/home/XXX/.local/lib/python3.6/site-packages/jedi/api/__init__.py", line 184, in <listcomp>                                                                                            
    or c._name.tree_name.get_definition().type in ('import_name', 'import_from')
AttributeError: 'NoneType' object has no attribute 'type'

I'm using jedi==0.13.0

@davidhalter
Copy link
Owner

Thanks for finding it. Should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants