Description
Warning, this bug can "corrupt" your ~/.pythonhist
. Before exploring it, make a backup of that file, and be prepared to delete it often.
Steps to reproduce: Write a command that has the size of precisely the screen length, as in: After typing the last character, a newline should happen. (This is another bug, but I don't care about it.) Press enter. Then type the first character of that command.
Expected behavior: bpython suggests the previous command.
Actual behavior: bpython crashes immediately after typing that first character.
Example session:
bpython version 0.17.1 on top of Python 3.7.2+ /usr/bin/python3
>>> s = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
>>>
Traceback (most recent call last):
File "/usr/bin/bpython3", line 11, in <module>
load_entry_point('bpython==0.17.1', 'console_scripts', 'bpython')()
File "/usr/lib/python3/dist-packages/bpython/curtsies.py", line 191, in main
exit_value = repl.mainloop(True, paste)
File "/usr/lib/python3/dist-packages/bpython/curtsies.py", line 126, in mainloop
self.process_event_and_paint(e)
File "/usr/lib/python3/dist-packages/bpython/curtsies.py", line 100, in process_event_and_paint
array, cursor_pos = self.paint()
File "/usr/lib/python3/dist-packages/bpython/curtsiesfrontend/repl.py", line 1497, in paint
if self.matches_iter.completer else None)
File "/usr/lib/python3/dist-packages/bpython/curtsiesfrontend/replpainter.py", line 181, in paint_infobox
return fsarray(0, 0)
File "/usr/lib/python3/dist-packages/curtsies/formatstringarray.py", line 48, in fsarray
strings = list(strings)
TypeError: 'int' object is not iterable
[$? = 1]
Note that I'm not sure about the set of vulnerable lengths. It may be that the bug-criterion is more general, but the above recipe always produces a crash.
Here's a screen capture of the bug happening:
bpython3-screen-overflow.zip
This bug seems unrelated from #113, since the stacktrace is very different.
EDIT: Yeah, I know, sorry for constantly running into weird edge cases. But I swear, I didn't want to run into this one! Or any of the others.