[Python-Dev] KeyboardInterrupt on Windows (original) (raw)

Neal Norwitz neal@metaslash.com
Fri, 30 May 2003 16:40:01 -0400


On Fri, May 30, 2003 at 04:35:53PM -0400, Guido van Rossum wrote:

I received this problem report (Kurt is the IDLEFORK developer). Does anybody know what could be the matter here? What changed recently???

while 1: pass

doesn't respond to a KeyboardInterrupt on Python2.3b1 on either WinXP or W2K.

Could this be from the optimization Raymond did:

def f(): ... while 1: pass

dis.dis(f) 2 0 SETUP_LOOP 12 (to 15) 3 JUMP_FORWARD 4 (to 10) 6 JUMP_IF_FALSE 4 (to 13) 9 POP_TOP 10 JUMP_ABSOLUTE 10 13 POP_TOP 14 POP_BLOCK 15 LOAD_CONST 0 (None) 18 RETURN_VALUE

3 jumps to 10, 10 jumps to itself unless I'm reading this wrong.

See Python/compile.c::optimize_code (starting around line 339)

Neal