This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mbrierst
Recipients
Date 2003-03-19.17:46:15
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
This patch attempts to fix raw_input so it
can be interrupted by signals.  In the process
it allows SIGINT handling to be honored by
raw_input.  (right now SIGINT always interrupts
regardless of any installed handlers)

Effects:
Signals are handled with their installed handlers
and when those handlers raise exceptions those
exceptions are raised by raw_input.  If an
exception is not raised, raw_input continues
collecting input as if nothing had happened.
This can be problematic if the signal causes
output to appear on the screen, messing up
the input line, or if someone using the
readline module was in the middle of a
complex operation, like a reverse search,
in which case that operation will be
cancelled.  It would be easy to instead
print a message ("Signal Interruption")
and continue input on a new line for the
readline library, but this couldn't happen
in myreadline.c as we can't retrieve the
partially entered input.

Backwards compatibility:
This patch requires the readline handler
(either call_readline or PyOS_StdioReadline
generally) to be called while holding the
global interpreter lock.  It is then
responsible for releasing the GIL before doing
blocking input. This will cause problems
for anyone who has written an extension
that installs a custom readline handler.
In python code, anyone using signals and
expecting raw_input not to be interrupted
by them will have problems (but this seems
unlikely).
History
Date User Action Args
2007-08-23 15:21:22adminlinkissue706406 messages
2007-08-23 15:21:22admincreate