I just tried this out, and you're a victim of http://bugs.python.org/issue2675 which is more a readline + curses problem than a Python issue.
In short, curses behavior changes based on the environmental variables LINES and COLUMNS, which readline sets.
If you add
import os
os.unsetenv('LINES')
os.unsetenv('COLUMNS')
Somewhere in there, it will remove the conflict and behave as you expect. If you want to be generous, you might want to save / restore =).