[ python-Bugs-964949 ] Ctrl-C causes odd behaviour

SourceForge.net noreply at sourceforge.net
Thu Nov 18 23:46:27 CET 2004


Bugs item #964949, was opened at 2004-06-02 11:17
Message generated for change (Comment added) made by tlynn
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=964949&group_id=5470

Category: Windows
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Michael Bax (mrbax)
Assigned to: Nobody/Anonymous (nobody)
Summary: Ctrl-C causes odd behaviour

Initial Comment:
With various versions of console Python 2.3.x under 
Windows 2000, executed using the "Python (command-
line)" Start Menu shortcut, I have noticed the following 
intermittent errors:

1. When pressing Ctrl-C at the prompt, Python 
terminates.

2. When pressing Ctrl-C during a raw_input, Python 
raises an EOFError instead of KeyboardInterrupt.

I usually cannot duplicate this behaviour by repeatedly 
pressing Ctrl-C or repeating the steps that led to it.

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

Comment By: Tom Lynn (tlynn)
Date: 2004-11-18 22:46

Message:
Logged In: YES 
user_id=915320

I just had this too.  Ctrl-C in a raw_input() caused it to
crash with a KeyboardInterrupt associated with the raw_input
line... which would be fine were it not for the fact that
that line was inside a try...except KeyboardInterrupt: pass
(at top level).

Running the same code again behaves properly (exits
silently).  The relevant section of the code was:
try:
    while 1:
        print ">>",
        x = raw_input()
        #...

except KeyboardInterrupt: pass # ctrl-c
except EOFError: pass # ctrl-d/ctrl-z

I'd had the window open for a long time while doing other
things and then woke it with ctrl-C, so it may well be a
"what happens when python is paged out/slow to respond" thing.

This was "Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC
v.1200 32 bit (Intel)] on win32" (Win2k)

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

Comment By: Michael Bax (mrbax)
Date: 2004-06-09 10:21

Message:
Logged In: YES 
user_id=1055057

It *is* intermittent.  Try entering the tutorial examples (copy 
and paste) and pressing Ctrl-C at random.  That works for me.

Here's another example: today I rebooted, then later clicked 
on the "Python (command-line)" shortcut.  I typed 1 and 
pressed ENTER.  I then pressed Ctrl-C.

Boom.  Window disappears.

I tried again around 20 times -- it gave a KeyboardInterrupt 
each time, as it should.

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

Comment By: Thomas Heller (theller)
Date: 2004-06-09 09:39

Message:
Logged In: YES 
user_id=11105

I cannot reproduce this behaviour, so I cannot do anything
on this.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=964949&group_id=5470


More information about the Python-bugs-list mailing list