[bzr-svn/merge] Don't overwrite bzrlib.errors.BzrError if sqlite3 is not available
jelmer at samba.org
Tue May 22 02:57:50 BST 2007
John Arbash Meinel wrote:
> I'm guessing this wasn't caught because Jelmer works mostly on
> python2.5. But in python2.4 the 'sqlite3' package isn't built-in. So
> this code has a problem:
> === modified file 'cache.py'
> --- cache.py 2007-05-20 21:31:44 +0000
> +++ cache.py 2007-05-21 16:33:53 +0000
> @@ -52,7 +52,7 @@
> import sqlite3
> - except ImportError, bzrlib.errors.BzrError:
> + except ImportError, e:
> from pysqlite2 import dbapi2 as sqlite3
> Basically, the way it is written, if the import fails, it assigns the
> ImportError object to bzrlib.errors.BzrError.
> Which causes *lots* of very strange problems. Because we use
> BzrError.__init__(), rather than super(). And we don't use super()
> because python2.4 Exception objects are not new-style classes.
> Anyway, the above patch makes things work correctly for me. I suppose if
> you really were worried about the other error you could make it:
> except (ImportError, bzrlib.errors.BzrError), e:
More information about the bazaar