Skip to content

Transpose with an empty line crashes bpython #548

Closed
@Julian

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.

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