[Python-bugs-list] [Bug #110641] KeyboardInterrupt while waiting for sys.ps2 input kills interpreter (PR#309)

noreply@sourceforge.net noreply@sourceforge.net
Sun, 6 Aug 2000 04:57:04 -0700


Bug #110641, was updated on 2000-Jul-31 14:09
Here is a current snapshot of the bug.

Project: Python
Category: Modules
Status: Open
Resolution: None
Bug Group: Platform-specific
Priority: 5
Summary: KeyboardInterrupt while waiting for sys.ps2 input kills interpreter (PR#309)

Details: Jitterbug-Id: 309
Submitted-By: skip@mojam.com
Date: Fri, 28 Apr 2000 17:00:40 -0400 (EDT)
Version: 1.5.2, 1.6a2
OS: Linux


If you hit Ctrl-C while the Python interpreter is sitting at the ps2 prompt the
interpreter exits instead of returning you to the top-level prompt.

% python
Python 1.5.2+ (#12, Feb 17 2000, 14:52:05)  [GCC pgcc-2.91.66 19990314
(egcs-1.1.2 release)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> if 1:
... 

% PYTHONSTARTUP= ./python
Python 1.6a2 (#7, Apr 24 2000, 23:02:54)  [GCC pgcc-2.91.66 19990314 (egcs-1.1.2
release)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> if 1:
... 

When run under gdb's control, you can see what's happening:

% gdb ./python
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-mandrake-linux"...
(gdb) set env PYTHONSTARTUP ""
(gdb) run
Starting program: /home/beluga/skip/src/python/dist/src/./python 
Python 1.6a2 (#7, Apr 24 2000, 23:02:54)  [GCC pgcc-2.91.66 19990314 (egcs-1.1.2
release)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> if 1:
... 
Program received signal SIGINT, Interrupt.
0x4013bf14 in __libc_read () from /lib/libc.so.6
(gdb) bt
#0  0x4013bf14 in __libc_read () from /lib/libc.so.6
(gdb) c
Continuing.

  File "<stdin>", line 2
    
    ^
SyntaxError: invalid syntax
>>> 

It appears that SIGINT isn't handled properly when awaiting console input in
certain circumstances.  If you can entice the program to continue, things work
okay.  I don't know interrupt handling from a hole in the ground or I'd
investigate further.  It is quite annoying, especially considering that
Python's input history isn't continuous across sessions...


Skip





====================================================================
Audit trail:
Mon May 22 17:23:42 2000	guido	changed notes
Mon May 22 17:23:42 2000	guido	moved from incoming to open

Follow-Ups:

Date: 2000-Jul-31 14:40
By: twouters

Comment:
This seems to be platform specific: On Linux, up-to-date CVS compile, this is reproducible. On BSDI 4.1, however, with an almost-up-to-date CVS compile, ^C doesn't exit the interpreter.

-------------------------------------------------------

Date: 2000-Aug-06 04:57
By: twouters

Comment:
Oh, and it's also definately readline-related. (without readline compiled in, the bug doesn't get triggered, in any case.)

-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=110641&group_id=5470