Skip to content

bpython-curtsies crashes if no readline history on enter #432

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

Closed
thomasballinger opened this issue Jan 7, 2015 · 4 comments
Closed

bpython-curtsies crashes if no readline history on enter #432

thomasballinger opened this issue Jan 7, 2015 · 4 comments

Comments

@thomasballinger
Copy link
Member

I think this is if you don't have a ~/.pythonhist file.

@thomasballinger
Copy link
Member Author

Traceback (most recent call last):
  File "/usr/local/bin/bpython-curtsies", line 9, in <module>
    load_entry_point('bpython==0.13.1', 'console_scripts', 'bpython-curtsies')()
  File "/usr/local/lib/python2.7/site-packages/bpython/curtsies.py", line 60, in main
    mainloop(config, locals_, banner, interp, paste)
  File "/usr/local/lib/python2.7/site-packages/bpython/curtsies.py", line 92, in mainloop
    process_event(term.get_annotated_event(idle=find_iterator))
  File "/usr/local/lib/python2.7/site-packages/bpython/curtsies.py", line 76, in process_event
    repl.process_event(e)
  File "/usr/local/lib/python2.7/site-packages/bpython/curtsiesfrontend/repl.py", line 341, in process_event
    self.on_enter()
  File "/usr/local/lib/python2.7/site-packages/bpython/curtsiesfrontend/repl.py", line 374, in on_enter
    self.rl_history.last()
  File "/usr/local/lib/python2.7/site-packages/bpython/repl.py", line 241, in last
    return self.entries[0]
IndexError: list index out of range

@thomasballinger
Copy link
Member Author

would also be good to check if this happens with bpython as well

@sebastinas
Copy link
Contributor

It does not happen with bpython.cli.

lvgelder added a commit to lvgelder/bpython that referenced this issue Jan 8, 2015


It actually works correctly if there is no existing history the first time you press enter. But then insert_into_history sets entries to [] and tries to read from the history file, which will do nothing if the history file is empty.

This is fixed properly on master, for now just change last() to return an empty string if history entries are empty.
thomasballinger pushed a commit that referenced this issue Jan 9, 2015
It actually works correctly if there is no existing history the first time you press enter.
But then insert_into_history sets entries to [] and tries to read from the history file,
which will do nothing if the history file is empty.

History should be fixed properly on master, but for now just fixing the
call which shouldn't have been rl_history.last() in the first place.
sebastinas added a commit that referenced this issue Jan 9, 2015
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
@sebastinas
Copy link
Contributor

Now fixed.

sebastinas added a commit that referenced this issue Jan 11, 2015
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
(cherry picked from commit b30971b)
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