[Python-Dev] KeyboardInterrupt on Windows
Neal Norwitz
neal@metaslash.com
Fri, 30 May 2003 17:04:30 -0400
On Fri, May 30, 2003 at 04:40:00PM -0400, Neal Norwitz wrote:
> 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.
The patch below fixes the problem by not optimizing while 1:pass.
Seems kinda hacky though.
Neal
--
Index: Python/compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.289
diff -w -u -r2.289 compile.c
--- Python/compile.c 22 May 2003 22:00:04 -0000 2.289
+++ Python/compile.c 30 May 2003 21:02:26 -0000
@@ -411,6 +411,8 @@
tgttgt -= i + 3; /* Calc relative jump addr
*/
if (tgttgt < 0) /* No backward relative jumps
*/
continue;
+ if (i == tgttgt && opcode == JUMP_ABSOLUTE)
+ goto exitUnchanged;
codestr[i] = opcode;
SETARG(codestr, i, tgttgt);
break;