Google Summer of Code: Bazaar-Visual Studio integration status update

Klaus Hartke klaus.hartke at googlemail.com
Sun Jul 15 23:45:28 BST 2007


Thank you very much for the hint, Robert. As discussed on IRC, the
hack should work but is not perfect: After the user pressed a 'cancel'
button, the operation would be canceled only as soon as the progress
bar would be updated next, i.e. as soon as the operation makes
progress. However, users tend to cancel operations if they do not make
any progress.

As it turns out, I was wrong and there is a way to raise a
KeyboardInterrupt programmatically. It's aptly named
PyErr_SetInterrupt() and is a API function that simulates the effect
of a SIGINT signal arriving.

This is a big improvement compared to the hack, because the function
can be called at any time. However, internally the function just sets
a flag. The Python interpreter regularly checks if the flag is set
and, if so, raises a KeyboardInterrupt. If the interpreter is calling
a long-running native function, it won't check the flag until the
function returns.

This is the case for example if a host is down and the native sockets
implementation tries to connect to it until a timeout occurs (which
is, depending on the implementation, usually 90 to 300 seconds).
During this time the user will see no progress. He has a 'cancel'
button that doesn't work and his only option is to kill the process
(i.e. Visual Studio). This is very frustrating.

I will go with PyErr_SetInterrupt() for now and continue looking for a
better solution. Any idea or suggestion his highly welcome.

--Klaus



More information about the bazaar mailing list