[issue1175004] Export more libreadline API functions

Simon Arlott report at bugs.python.org
Sat Sep 26 13:48:35 CEST 2009


Simon Arlott <python.simon at arlott.org> added the comment:

Access to rl_reset_line_state (and possibly others in the Redisplay
section) are also required, otherwise it's not possible to recover from
KeyboardInterrupt during raw_input() if readline isn't in the expected
editing mode.

Example:
  1. call raw_input() and use ctrl-R (reverse-i-search)
  2. catch a KeyboardInterrupt
  3. call raw_input() again

The input editing is still in reverse-i-search mode.
This makes it impractical to use raw_input() again after
KeyboardInterrupt because the input buffer may be in an unknown state.
If the history is modified then the search will break and character
input will appear to be ignored.

Note: It may be desirable to stay in this mode and call raw_input()
again, ignoring KeyboardInterrupt entirely (although the prompt is
redisplayed when exiting search mode so that doesn't currently work
cleanly), so it can't just auto-reset on KeyboardInterrupt.

The documentation should explain how to resume after KeyboardInterrupt
safely.

----------
nosy: +lp0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1175004>
_______________________________________


More information about the Python-bugs-list mailing list