[Pyrex] while loop not detecting ctrl-c

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Nov 26 01:46:53 CET 2003


Bryan Weingarten <bryan.weingarten at pobox.com>:

> when Play.play() is called and a callback parameter is specified, the
> user can do a ctrl-c (on windows) and break out of the play.  my guess
> why this works is that the callback ends up in the python interpreter
> and the pyrex "except *" is able to detect it with PyErr_Occurred().
> but if callback is not specified, the while loop never goes back to
> the python interpreter during the loop and the ctrl-c doesn't get
> detected.

I'd say your guess is spot-on.

You could fix this by having the extension always install a callback,
either a user-supplied one or a default one that does nothing other
than allow the exception to be detected.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list