Skip to content

Transpose with an empty line crashes bpython #548

Closed

Description

@Julian

Minor edge case I think:

⊙  bpython                                                                                                                                                                                                                                                                                                                                                Julian@Macnetic
bpython version 0.15.dev155 on top of Python 2.7.10 /usr/local/opt/python/bin/python2.7
>>>
Traceback (most recent call last):
  File "/usr/local/bin/bpython", line 9, in <module>
    load_entry_point('bpython==0.15.dev155', 'console_scripts', 'bpython')()
  File "/usr/local/lib/python2.7/site-packages/bpython/curtsies.py", line 88, in main
    interactive=(not exec_args))
  File "/usr/local/lib/python2.7/site-packages/bpython/curtsies.py", line 189, in mainloop
    process_event(e)
  File "/usr/local/lib/python2.7/site-packages/bpython/curtsies.py", line 147, in process_event
    repl.process_event(e)
  File "/usr/local/lib/python2.7/site-packages/bpython/curtsiesfrontend/repl.py", line 524, in process_event
    return self.process_key_event(e)
  File "/usr/local/lib/python2.7/site-packages/bpython/curtsiesfrontend/repl.py", line 626, in process_key_event
    cut_buffer=self.cut_buffer)
  File "/usr/local/lib/python2.7/site-packages/bpython/curtsiesfrontend/manual_readline.py", line 67, in call
    return func(**args)
  File "/usr/local/lib/python2.7/site-packages/bpython/curtsiesfrontend/manual_readline.py", line 286, in transpose_character_before_cursor
    line[cursor_offset - 1] +
IndexError: string index out of range

Also, I encountered this because I tried to send SIGINFO to bpython which is bound to ^T by default, and being overridden here for the readline stuff. Not sure if that's intentional as well, I don't know what OS X uses for readline transpose instead.

Activity

  1. added a commit that references this issue on Aug 26, 2015
  2. added a commit that references this issue on Aug 26, 2015
  3. sebastinas commented on Aug 27, 2015

    @sebastinas
    Contributor

    This should be fixed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions