[bzr-svn/merge] Don't overwrite bzrlib.errors.BzrError if sqlite3 is not available
John Arbash Meinel
john at arbash-meinel.com
Mon May 21 17:39:01 BST 2007
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 @@
try:
import sqlite3
check_pysqlite_version(sqlite3)
- except ImportError, bzrlib.errors.BzrError:
+ except ImportError, e:
from pysqlite2 import dbapi2 as sqlite3
check_pysqlite_version(sqlite3)
except:
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:
John
=:->
More information about the bazaar
mailing list