[MERGE] setlocale (#128496)

Martin von Gagern Martin.vGagern at gmx.net
Tue Jun 17 14:05:24 BST 2008


Aaron Bentley wrote:
>> Notice that a KeyboardInterrupt is a BaseException but not an instance
>> of Exception,
> 
> That change was made in python2.5.  But we support 2.4.
> KeyboardInterrupt is a subclass of StandardError on python 2.4

Hmmm... OK, so what to do now? We have several options.

1. Leave it as it is in my patch
2. Reduce the kinds of errors caught to TypeError and ValueError
3. Add special handling for KeyboardInterrupt and reraise that
4. Drop _safe_string and accept that broken reports might break the test 
suite from time to time

There are several arguments why 1. is not really as bad as it might seem 
at first glance:

a) Only affects test suite, not production uses
b) Function only called if a test fails and its report won't convert, so 
it should never get called in the first place
c) Only a problem on Python < 2.5
d) String conversion shouldn't be time consuming, so interrupting just 
while the conversion is running should be extremely unlikely
e) Will not loop endlessly, a maximum of two such exceptions get caught 
per invocation.

Come to think of it, it might even be considered a feature that aborting 
a lengthy (and thus probably broken) conversion of an object to string 
can be interrupted without aborting the whole test suite.

Although I'm willing to implement any of my suggestions, I personally 
would leave it as it is in my patch, and not invest too much effort and 
lines of code into a corner case that has little to no practical impact.

If you are interested, I can later try to reproduce the errors that 
originally led me to introduce this thing, so you can see how individual 
test cases can break the whole suite under certain circumstances.

Greetings,
  Martin von Gagern

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080617/0298fd20/attachment.pgp 


More information about the bazaar mailing list