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 while making recursive function #37

Closed
pgy opened this issue Oct 3, 2014 · 3 comments
Closed

IndexError while making recursive function #37

pgy opened this issue Oct 3, 2014 · 3 comments

Comments

@pgy
Copy link
Contributor

pgy commented Oct 3, 2014

IndexError was thrown while typing the following:

➜  ~  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

Full output:

➜  ~  ptpython --vi
In [1]: def bez(cps, t):
     2.     if len(cps) < 2:                        
     3.         return cps[0]                           
     4.     p1 = bez(Traceback (most recent call last):
  File "/usr/local/bin/ptpython", line 80, in <module>
    _run_repl()       all                        
  File "/usr/local/bin/ptpython", line 77, in _run_repl
    startup_paths=startup_paths, always_multiline=always_multiline)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/contrib/repl.py",d
    cli.start_repl(startup_paths=startup_paths)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/contrib/repl.py",l
    on_exit=AbortAction.RAISE_EXCEPTION)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/__init__.py", lint
    self._redraw()
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/__init__.py", linw
    self.renderer.render(self)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/renderer.py", linr
    output = self.render_to_str(cli)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/renderer.py", linr
    self.layout.write_to_screen(cli, screen, height)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/layout/__init__.pn
    t.write(cli, screen)z(cps, t)                                               
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/layout/toolbars.pe
    tokens = self.get_tokens(cli, width)
  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
@pgy pgy changed the title IndexError IndexError while making recursive function Oct 3, 2014
@pgy
Copy link
Contributor Author

pgy commented Oct 3, 2014

➜  ~  uname -a && python --version && pip freeze | grep -P 'jedi|prompt|wcwidth|docop'
Linux ygp-vbox 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Python 2.7.6
docopt==0.6.2
jedi==0.8.1-final0
prompt-toolkit==0.19
wcwidth==0.1.1

@jonathanslenders
Copy link
Member

Thank you @pgy for reporting. I could reproduce it. It happens already at the following recursive input:

def a():
   a(b[0:

Unfortunately this is a bug in Jedi, i created a workaround until it's fixed there: 36efe35

@jonathanslenders
Copy link
Member

Hi all, closing this ticket because ptpython was removed from prompt-toolkit and got its own repository: https://github.com/jonathanslenders/ptpython/ . Further, the Jedi library for ptpython has been upgraded and we handle all known exceptions already. Let's create a new ticket if it happens again.

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

No branches or pull requests

2 participants