[Python-checkins] r43730 - in python/branches/release24-maint: Lib/bsddb/test/test_all.py Lib/bsddb/test/test_pickle.py Misc/NEWS Modules/_bsddb.c (original) (raw)
gregory.p.smith python-checkins at python.org
Sat Apr 8 09:34:10 CEST 2006
- Previous message: [Python-checkins] buildbot warnings in x86 OpenBSD trunk
- Next message: [Python-checkins] buildbot warnings in x86 OpenBSD 2.4
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: gregory.p.smith Date: Sat Apr 8 09:34:08 2006 New Revision: 43730
Added: python/branches/release24-maint/Lib/bsddb/test/test_pickle.py - copied unchanged from r43729, python/trunk/Lib/bsddb/test/test_pickle.py Modified: python/branches/release24-maint/Lib/bsddb/test/test_all.py python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Modules/_bsddb.c Log: Fix bsddb.db.DBError derived exceptions so they can be unpickled. (backport of trunk commit 43729)
Modified: python/branches/release24-maint/Lib/bsddb/test/test_all.py
--- python/branches/release24-maint/Lib/bsddb/test/test_all.py (original) +++ python/branches/release24-maint/Lib/bsddb/test/test_all.py Sat Apr 8 09:34:08 2006 @@ -64,6 +64,7 @@ 'test_join', 'test_lock', 'test_misc',
'test_pickle', 'test_queue', 'test_recno', 'test_thread',
Modified: python/branches/release24-maint/Misc/NEWS
--- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Sat Apr 8 09:34:08 2006 @@ -15,6 +15,8 @@ Extension Modules
+- Fix bsddb.db.DBError derived exceptions so they can be unpickled. + Library
Modified: python/branches/release24-maint/Modules/_bsddb.c
--- python/branches/release24-maint/Modules/_bsddb.c (original)
+++ python/branches/release24-maint/Modules/_bsddb.c Sat Apr 8 09:34:08 2006
@@ -97,7 +97,7 @@
#error "eek! DBVER can't handle minor versions > 9"
#endif
-#define PY_BSDDB_VERSION "4.3.0.1"
+#define PY_BSDDB_VERSION "4.3.0.2"
static char rcs_id = "$Id$";
@@ -5128,9 +5128,21 @@
ADD_INT(d, DB_SET_TXN_TIMEOUT);
#endif
+ / The exception name must be correct for pickled exception *
+ * objects to unpickle properly. /
+#ifdef PYBSDDB_STANDALONE / different value needed for standalone pybsddb /
+#define PYBSDDB_EXCEPTION_BASE "bsddb3.db."
+#else
+#define PYBSDDB_EXCEPTION_BASE "bsddb.db."
+#endif
+
+ / All the rest of the exceptions derive only from DBError /
+#define MAKE_EX(name) name = PyErr_NewException(PYBSDDB_EXCEPTION_BASE #name, DBError, NULL);
+ PyDict_SetItemString(d, #name, name)
+
/ The base exception class is DBError /
- DBError = PyErr_NewException("bsddb._db.DBError", NULL, NULL);
- PyDict_SetItemString(d, "DBError", DBError);
+ DBError = NULL; / used in MAKE_EX so that it derives from nothing /
+ MAKE_EX(DBError);
/ Some magic to make DBNotFoundError derive from both DBError and
KeyError, since the API only supports using one base class. /
@@ -5141,10 +5153,6 @@
PyDict_DelItemString(d, "KeyError");
- / All the rest of the exceptions derive only from DBError */
-#define MAKE_EX(name) name = PyErr_NewException("bsddb._db." #name, DBError, NULL);
- PyDict_SetItemString(d, #name, name)
#if !INCOMPLETE_IS_WARNING MAKE_EX(DBIncompleteError); #endif
- Previous message: [Python-checkins] buildbot warnings in x86 OpenBSD trunk
- Next message: [Python-checkins] buildbot warnings in x86 OpenBSD 2.4
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]