Submitted By:            Igor Zivkovic <igor@linuxfromscratch.org>
Date:                    2004-12-09
Initial Package Version: 2.3.4
Upstream Status:         Submitted at Python patch tracker.
Origin:                  Michal Cihar and Suzuki Hisao
Description:             Adds support for Berkeley DB-4.3.x.

$LastChangedBy: igor $
$Date: 2005-01-10 15:43:51 -0700 (Mon, 10 Jan 2005) $

--- Python-2.3.4/Modules/_bsddb.c.orig	2004-12-09 15:26:24.807332600 +0000
+++ Python-2.3.4/Modules/_bsddb.c	2004-12-09 15:26:39.966028128 +0000
@@ -422,7 +422,15 @@
 /* Callback used to save away more information about errors from the DB
  * library. */
 static char _db_errmsg[1024];
-static void _db_errorCallback(const char* prefix, char* msg)
+static void _db_errorCallback(
+#if (DBVER >= 43)
+        const DB_ENV *dbenv,
+#endif
+        const char* prefix, 
+#if (DBVER >= 43)
+        const 
+#endif
+        char* msg)
 {
     strcpy(_db_errmsg, msg);
 }
@@ -1987,7 +1995,11 @@
 
     MYDB_BEGIN_ALLOW_THREADS;
 #if (DBVER >= 33)
-    err = self->db->stat(self->db, &sp, flags);
+    err = self->db->stat(self->db, 
+#if (DBVER >= 43)
+            NULL /*txnid*/,
+#endif
+            &sp, flags);
 #else
     err = self->db->stat(self->db, &sp, NULL, flags);
 #endif
@@ -2249,7 +2261,11 @@
 
     MYDB_BEGIN_ALLOW_THREADS;
 #if (DBVER >= 33)
-    err = self->db->stat(self->db, &sp, flags);
+    err = self->db->stat(self->db, 
+#if (DBVER >= 43)
+            NULL /*txnid*/,
+#endif
+            &sp, flags);
 #else
     err = self->db->stat(self->db, &sp, NULL, flags);
 #endif
@@ -2375,7 +2391,11 @@
     err = self->db->get(self->db, txn, &key, &data, 0);
     MYDB_END_ALLOW_THREADS;
     FREE_DBT(key);
+#if (DBVER >= 43)
+    return PyInt_FromLong((err == DB_BUFFER_SMALL) || (err == 0));
+#else
     return PyInt_FromLong((err == ENOMEM) || (err == 0));
+#endif
 }
 
 
@@ -4527,7 +4547,12 @@
 
 #if (DBVER >= 33)
     ADD_INT(d, DB_LSTAT_ABORTED);
+#if (DBVER < 43)
     ADD_INT(d, DB_LSTAT_ERR);
+#endif
+#if (DBVER >= 42)
+    ADD_INT(d, DB_LSTAT_EXPIRED);
+#endif
     ADD_INT(d, DB_LSTAT_FREE);
     ADD_INT(d, DB_LSTAT_HELD);
 #if (DBVER == 33)
--- Python-2.3.4/setup.py.orig	2004-12-09 15:26:30.007542048 +0000
+++ Python-2.3.4/setup.py	2004-12-09 15:26:39.971027368 +0000
@@ -480,7 +480,7 @@
         # when sorted in reverse order, keys for this dict must appear in the
         # order you wish to search - e.g., search for db4 before db3
         db_try_this = {
-            'db4': {'libs': ('db-4.2', 'db42', 'db-4.1', 'db41', 'db-4.0', 'db4',),
+            'db4': {'libs': ('db-4.3', 'db43', 'db-4.2', 'db42', 'db-4.1', 'db41', 'db-4.0', 'db4',),
                     'libdirs': ('/usr/local/BerkeleyDB.4.2/lib',
                                 '/usr/local/BerkeleyDB.4.1/lib',
                                 '/usr/local/BerkeleyDB.4.0/lib',
