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

IndexError when calling full_name of signature. #490

Closed
jonathanslenders opened this issue Oct 3, 2014 · 6 comments
Closed

IndexError when calling full_name of signature. #490

jonathanslenders opened this issue Oct 3, 2014 · 6 comments
Labels

Comments

@jonathanslenders
Copy link

See: prompt-toolkit/python-prompt-toolkit#37

Getting the signature of the following input fails:

  ~  ptpython --vi
    In [1]: def bez(cps, t):
        2.     if len(cps) < 2:                        
        3.         return cps[0]                           
        4.     p1 = bez(cps[0:
                            ^--- Exception happened here

Traceback:

      File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/contrib/python_ins
        append((Signature, sig.full_name))
      File "/usr/local/lib/python2.7/dist-packages/jedi/api/classes.py", line 295, e
        path = [unicode(p) for p in self._path()]
      File "/usr/local/lib/python2.7/dist-packages/jedi/api/classes.py", line 170, h
        path.insert(0, par.name)
      File "/usr/local/lib/python2.7/dist-packages/jedi/api/interpreter.py", line 3_
        return getattr(self.parser_module, name)
      File "/usr/local/lib/python2.7/dist-packages/jedi/parser/fast.py", line 38, i_
        return getattr(self.parsers[0].module, name)
    IndexError: list index out of range
@jonathanslenders
Copy link
Author

It looks like the following input raises the same error:

def a():
   a(b[0:

@davidhalter davidhalter added the bug label Oct 4, 2014
@thomasballinger
Copy link

Not sure if this is the same bug, but I get a similar trace from the following code: (see bpython/bpython#483)

>>> class Foo():
...     return

@davidhalter
Copy link
Owner

Did you both try with the latest dev branch? I have changed a few things in the interpreter completion system.

@thomasballinger
Copy link

That fixes my example!

@davidhalter
Copy link
Owner

Pretty sure it also fixes @jonathanslenders problem.

@davidhalter
Copy link
Owner

>>> jedi.Interpreter('def a():\n   a(b[0:', path='', namespaces=[locals()]).call_signatures()
[<CallSignature: a index None>]

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

No branches or pull requests

3 participants