--- /dev/null
+diff -ru Python-2.5.2-orig/Modules/_bsddb.c Python-2.5.2/Modules/_bsddb.c
+--- Python-2.5.2-orig/Modules/_bsddb.c 2008-02-03 02:26:23.000000000 -0500
++++ Python-2.5.2/Modules/_bsddb.c 2008-09-24 17:01:50.000000000 -0400
+@@ -5335,11 +5335,13 @@
+ DBEnv_getattr(DBEnvObject* self, char *name)
+ {
+ if (!strcmp(name, "db_home")) {
++ const char *home = NULL;
+ CHECK_ENV_NOT_CLOSED(self);
+- if (self->db_env->db_home == NULL) {
++ self->db_env->get_home(self->db_env, &home);
++ if (home == NULL) {
+ RETURN_NONE();
+ }
+- return PyString_FromString(self->db_env->db_home);
++ return PyString_FromString(home);
+ }
+
+ return Py_FindMethod(DBEnv_methods, (PyObject* )self, name);
+@@ -5961,22 +5963,37 @@
+ ADD_INT(d, DB_TIME_NOTGRANTED);
+ ADD_INT(d, DB_TXN_NOT_DURABLE);
+ ADD_INT(d, DB_TXN_WRITE_NOSYNC);
+- ADD_INT(d, DB_LOG_AUTOREMOVE);
+- ADD_INT(d, DB_DIRECT_LOG);
+ ADD_INT(d, DB_DIRECT_DB);
+ ADD_INT(d, DB_INIT_REP);
+ ADD_INT(d, DB_ENCRYPT);
+ ADD_INT(d, DB_CHKSUM);
+ #endif
+
++#if (DBVER >= 42) && (DBVER < 47)
++ ADD_INT(d, DB_LOG_AUTOREMOVE);
++ ADD_INT(d, DB_DIRECT_LOG);
++#endif
++
++#if (DBVER >= 47)
++ ADD_INT(d, DB_LOG_DIRECT);
++ ADD_INT(d, DB_LOG_DSYNC);
++ ADD_INT(d, DB_LOG_IN_MEMORY);
++ ADD_INT(d, DB_LOG_AUTO_REMOVE);
++ ADD_INT(d, DB_LOG_ZERO);
++#endif
++
+ #if (DBVER >= 43)
+- ADD_INT(d, DB_LOG_INMEMORY);
+ ADD_INT(d, DB_BUFFER_SMALL);
+ ADD_INT(d, DB_SEQ_DEC);
+ ADD_INT(d, DB_SEQ_INC);
+ ADD_INT(d, DB_SEQ_WRAP);
+ #endif
+
++#if (DBVER >= 43) && (DBVER < 47)
++ ADD_INT(d, DB_LOG_INMEMORY);
++ ADD_INT(d, DB_DSYNC_LOG);
++#endif
++
+ #if (DBVER >= 41)
+ ADD_INT(d, DB_ENCRYPT_AES);
+ ADD_INT(d, DB_AUTO_COMMIT);
+diff -ru Python-2.5.2-orig/setup.py Python-2.5.2/setup.py
+--- Python-2.5.2-orig/setup.py 2008-09-24 17:01:02.000000000 -0400
++++ Python-2.5.2/setup.py 2008-09-24 17:03:05.000000000 -0400
+@@ -608,12 +608,12 @@
+ # a release. Most open source OSes come with one or more
+ # versions of BerkeleyDB already installed.
+
+- max_db_ver = (4, 5)
++ max_db_ver = (4, 7)
+ # NOTE: while the _bsddb.c code links against BerkeleyDB 4.6.x
+ # we leave that version disabled by default as it has proven to be
+ # quite a buggy library release on many platforms.
+ min_db_ver = (3, 3)
+- db_setup_debug = False # verbose debug prints from this script?
++ db_setup_debug = True # verbose debug prints from this script?
+
+ # construct a list of paths to look for the header file in on
+ # top of the normal inc_dirs.