[BUG] statcache throws the wrong exception

John A Meinel john at arbash-meinel.com
Mon Jun 6 18:23:49 BST 2005


In statcache there are 2 checks to make sure that the number of entries
is correct. In both cases, if it is wrong, it throws an exception.
However, the exception is written as:

raise ValueError("invalid statcache entry tuple %r" % entry)

But since 'entry' is a tuple, this doesn't consume all of the pieces,
which throws a different error. You really want:

raise ValueError("invalid statcache entry tuple %r" % (entry, ))

This is both on line 126 and 190.

In fact, in general, the safe way to format a string is with the above
syntax "%(item,)", just in case the item you are formatting happens to
be a tuple.

John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050606/0ef06dce/attachment.pgp 


More information about the bazaar mailing list