Merged revisions 58817-58861 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r58822 | brett.cannon | 2007-11-02 23:47:02 -0700 (Fri, 02 Nov 2007) | 2 lines

  Add a missing quotation mark.
........
  r58840 | skip.montanaro | 2007-11-04 07:56:52 -0800 (Sun, 04 Nov 2007) | 2 lines

  Note change to get_dialect semantics in 2.5.  Will backport to 2.5.
........
  r58844 | georg.brandl | 2007-11-04 09:43:49 -0800 (Sun, 04 Nov 2007) | 2 lines

  Fix syntax for versionchanged markup.
........
  r58850 | gregory.p.smith | 2007-11-04 18:32:26 -0800 (Sun, 04 Nov 2007) | 9 lines

  Fixes bug 477182 on pybsddb.sf.net.  DB objects now load the flags and
  pay attention to them when opening an existing database.  This means
  that d[] behaves properly even on databases previously created with DB_DUP
  or DB_DUPSORT flags to allow duplicate keys.

  http://sourceforge.net/tracker/index.php?func=detail&aid=477182&group_id=13900&atid=113900

  Do not backport, this bugfix could be considered an API change.
........
  r58851 | gregory.p.smith | 2007-11-04 18:56:31 -0800 (Sun, 04 Nov 2007) | 3 lines

  Add the bsddb.db.DBEnv.lock_id_free method.
  Improve test_lock's tempdir creation and cleanup.
........
  r58852 | gregory.p.smith | 2007-11-05 01:06:28 -0800 (Mon, 05 Nov 2007) | 3 lines

   * db->get_types is only available in BerkeleyDB >= 4.2
   * get compiling with older versions of python again for a stand alone release.
........
  r58853 | gregory.p.smith | 2007-11-05 01:07:40 -0800 (Mon, 05 Nov 2007) | 2 lines

  * db->get_flags is only available in BerkeleyDB >= 4.2
........
  r58854 | mark.summerfield | 2007-11-05 01:22:48 -0800 (Mon, 05 Nov 2007) | 3 lines

  Added cross-references between the various archive file formats.
........
  r58857 | mark.summerfield | 2007-11-05 06:38:50 -0800 (Mon, 05 Nov 2007) | 5 lines

  Clarified the fact that you can have comments for individual archive
  members even though comments to the archive itself aren't currently
  supported.
........
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
index 8414618..bd1c271 100644
--- a/Modules/_bsddb.c
+++ b/Modules/_bsddb.c
@@ -1940,21 +1940,6 @@
         return NULL;
     }
 
-#if 0 && (DBVER >= 41)
-    if ((!txn) && (txnobj != Py_None) && self->myenvobj
-        && (self->myenvobj->flags & DB_INIT_TXN))
-    {
-	/* If no 'txn' parameter was supplied (no DbTxn object and None was not
-	 * explicitly passed) but we are in a transaction ready environment:
-	 *   add DB_AUTO_COMMIT to allow for older pybsddb apps using transactions
-	 *   to work on BerkeleyDB 4.1 without needing to modify their
-	 *   DBEnv or DB open calls. 
-	 * TODO make this behaviour of the library configurable.
-	 */
-	flags |= DB_AUTO_COMMIT;
-    }
-#endif
-
     MYDB_BEGIN_ALLOW_THREADS;
 #if (DBVER >= 41)
     err = self->db->open(self->db, txn, filename, dbname, type, flags, mode);
@@ -1968,6 +1953,10 @@
         return NULL;
     }
 
+#if (DBVER >= 42)
+    self->db->get_flags(self->db, &self->setflags);
+#endif
+
     self->flags = flags;
     RETURN_NONE();
 }
@@ -4390,6 +4379,24 @@
     return PyInt_FromLong((long)theID);
 }
 
+#if (DBVER >= 40)
+static PyObject*
+DBEnv_lock_id_free(DBEnvObject* self, PyObject* args)
+{
+    int err;
+    u_int32_t theID;
+
+    if (!PyArg_ParseTuple(args, "I:lock_id_free", &theID))
+        return NULL;
+
+    CHECK_ENV_NOT_CLOSED(self);
+    MYDB_BEGIN_ALLOW_THREADS;
+    err = self->db_env->lock_id_free(self->db_env, theID);
+    MYDB_END_ALLOW_THREADS;
+    RETURN_IF_ERR();
+    RETURN_NONE();
+}
+#endif
 
 static PyObject*
 DBEnv_lock_put(DBEnvObject* self, PyObject* args)
@@ -5266,6 +5273,9 @@
     {"lock_detect",     (PyCFunction)DBEnv_lock_detect,      METH_VARARGS},
     {"lock_get",        (PyCFunction)DBEnv_lock_get,         METH_VARARGS},
     {"lock_id",         (PyCFunction)DBEnv_lock_id,          METH_VARARGS},
+#if (DBVER >= 40)
+    {"lock_id_free",    (PyCFunction)DBEnv_lock_id_free,     METH_VARARGS},
+#endif
     {"lock_put",        (PyCFunction)DBEnv_lock_put,         METH_VARARGS},
     {"lock_stat",       (PyCFunction)DBEnv_lock_stat,        METH_VARARGS},
     {"log_archive",     (PyCFunction)DBEnv_log_archive,      METH_VARARGS},