rpms/python/devel disable-pymalloc-on-valgrind-py26.patch, NONE, 1.1 python-2.6-update-bsddb3-4.8.patch, NONE, 1.1 python-2.6.4-setup-db48.patch, NONE, 1.1 python.spec, 1.155, 1.156

dmalcolm dmalcolm at fedoraproject.org
Fri Dec 18 03:20:51 UTC 2009


Author: dmalcolm

Update of /cvs/pkgs/rpms/python/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv21054

Modified Files:
	python.spec 
Added Files:
	disable-pymalloc-on-valgrind-py26.patch 
	python-2.6-update-bsddb3-4.8.patch 
	python-2.6.4-setup-db48.patch 
Log Message:
* Wed Dec 16 2009 David Malcolm <dmalcolm at redhat.com> - 2.6.4-4
- automatically disable arena allocator when run under valgrind (upstream
issue 2422; patch 52)
- add patch from Josh Boyer containing diff against upstream PyBSDDB to make
the bsddb module compile against db-4.8 (patch 53, #544275); bump the necessary
version of db4-devel to 4.8
- patch setup.py so that it searches for db-4.8, and enable debug output for
said search; make Setup.dist use db-4.8 (patch 54)


disable-pymalloc-on-valgrind-py26.patch:
 Misc/NEWS          |    5 +++++
 Objects/obmalloc.c |   35 +++++++++++++++++++++++++++++++++++
 configure.in       |   13 +++++++++++++
 pyconfig.h.in      |    3 +++
 4 files changed, 56 insertions(+)

--- NEW FILE disable-pymalloc-on-valgrind-py26.patch ---
Index: configure.in
===================================================================
--- configure.in	(revision 61828)
+++ configure.in	(working copy)
@@ -2232,6 +2232,19 @@ then
 fi
 AC_MSG_RESULT($with_pymalloc)
 
+# Check for Valgrind support
+AC_MSG_CHECKING([for --with-valgrind])
+AC_ARG_WITH([valgrind],
+  AC_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
+  with_valgrind=no)
+AC_MSG_RESULT([$with_valgrind])
+if test "$with_valgrind" != no; then
+    AC_CHECK_HEADER([valgrind/valgrind.h],
+      [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
+      [AC_MSG_ERROR([Valgrind support requested but headers not available])]
+    )
+fi
+
 # Check for --with-wctype-functions
 AC_MSG_CHECKING(for --with-wctype-functions)
 AC_ARG_WITH(wctype-functions, 
Index: Objects/obmalloc.c
===================================================================
--- Objects/obmalloc.c	(revision 61828)
+++ Objects/obmalloc.c	(working copy)
@@ -2,6 +2,21 @@
 
 #ifdef WITH_PYMALLOC
 
+#ifdef WITH_VALGRIND
+#include <valgrind/valgrind.h>
+
+/* If we're using GCC, use __builtin_expect() to reduce overhead of
+   the valgrind checks */
+#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
+#  define UNLIKELY(value) __builtin_expect((value), 0)
+#else
+#  define UNLIKELY(value) (value)
+#endif
+
+/* -1 indicates that we haven't checked that we're running on valgrind yet. */
+static int running_on_valgrind = -1;
+#endif
+
 /* An object allocator for Python.
 
    Here is an introduction to the layers of the Python memory architecture,
@@ -726,6 +741,13 @@ PyObject_Malloc(size_t nbytes)
 	poolp next;
 	uint size;
 
+#ifdef WITH_VALGRIND
+	if (UNLIKELY(running_on_valgrind == -1))
+		running_on_valgrind = RUNNING_ON_VALGRIND;
+	if (UNLIKELY(running_on_valgrind))
+		goto redirect;
+#endif
+
 	/*
 	 * This implicitly redirects malloc(0).
 	 */
@@ -916,6 +938,11 @@ PyObject_Free(void *p)
 	if (p == NULL)	/* free(NULL) has no effect */
 		return;
 
+#ifdef WITH_VALGRIND
+	if (UNLIKELY(running_on_valgrind > 0))
+		goto redirect;
+#endif
+
 	pool = POOL_ADDR(p);
 	if (Py_ADDRESS_IN_RANGE(p, pool)) {
 		/* We allocated this address. */
@@ -1110,6 +1137,7 @@ PyObject_Free(void *p)
 		return;
 	}
 
+redirect:
 	/* We didn't allocate this address. */
 	free(p);
 }
@@ -1130,6 +1158,12 @@ PyObject_Realloc(void *p, size_t nbytes)
 	if (p == NULL)
 		return PyObject_Malloc(nbytes);
 
+#ifdef WITH_VALGRIND
+	/* Treat running_on_valgrind == -1 the same as 0 */
+	if (UNLIKELY(running_on_valgrind > 0))
+		goto redirect;
+#endif
+
 	pool = POOL_ADDR(p);
 	if (Py_ADDRESS_IN_RANGE(p, pool)) {
 		/* We're in charge of this block */
@@ -1157,6 +1191,7 @@ PyObject_Realloc(void *p, size_t nbytes)
 		}
 		return bp;
 	}
+ redirect:
 	/* We're not managing this block.  If nbytes <=
 	 * SMALL_REQUEST_THRESHOLD, it's tempting to try to take over this
 	 * block.  However, if we do, we need to copy the valid data from
Index: Misc/NEWS
===================================================================
--- Misc/NEWS	(revision 61828)
+++ Misc/NEWS	(working copy)
@@ -60,6 +60,11 @@ Core and builtins
 
 - Issue #2143: Fix embedded readline() hang on SSL socket EOF.
 
+- Issue #2422: When compiled with the ``--with-valgrind`` option, the
+  pymalloc allocator will be automatically disabled when running under
+  Valgrind.  This gives improved memory leak detection when running
+  under Valgrind, while taking advantage of pymalloc at other times.
+
 Library
 -------
 
Index: pyconfig.h.in
===================================================================
--- pyconfig.h.in	(revision 61828)
+++ pyconfig.h.in	(working copy)
@@ -958,6 +958,9 @@
 /* Define to profile with the Pentium timestamp counter */
 #undef WITH_TSC
 
+/* Define if you want pymalloc to be disabled when running under valgrind */
+#undef WITH_VALGRIND
+
 
  /* Define to 1 if your processor stores words with the most significant byte
     first (like Motorola and SPARC, unlike Intel and VAX). 

python-2.6-update-bsddb3-4.8.patch:
 Lib/bsddb/__init__.py                           |   14 
 Lib/bsddb/dbobj.py                              |   21 
 Lib/bsddb/dbtables.py                           |    9 
 Lib/bsddb/dbutils.py                            |    2 
 Lib/bsddb/test/test_all.py                      |   44 
 Lib/bsddb/test/test_associate.py                |   66 -
 Lib/bsddb/test/test_basics.py                   |  163 ++
 Lib/bsddb/test/test_compare.py                  |   22 
 Lib/bsddb/test/test_compat.py                   |    2 
 Lib/bsddb/test/test_dbenv.py                    |  148 ++
 Lib/bsddb/test/test_dbtables.py                 |   16 
 Lib/bsddb/test/test_distributed_transactions.py |    6 
 Lib/bsddb/test/test_early_close.py              |   13 
 Lib/bsddb/test/test_fileid.py                   |   63 +
 Lib/bsddb/test/test_lock.py                     |   15 
 Lib/bsddb/test/test_pickle.py                   |   12 
 Lib/bsddb/test/test_recno.py                    |    2 
 Lib/bsddb/test/test_replication.py              |   25 
 Lib/bsddb/test/test_sequence.py                 |    8 
 Lib/bsddb/test_support.py                       |   54 
 Modules/_bsddb.c                                | 1426 ++++++++++++++++++++----
 Modules/bsddb.h                                 |   13 
 22 files changed, 1815 insertions(+), 329 deletions(-)

--- NEW FILE python-2.6-update-bsddb3-4.8.patch ---
diff -Nupr Python-2.6.4.orig/Lib/bsddb/dbobj.py Python-2.6.4/Lib/bsddb/dbobj.py
--- Python-2.6.4.orig/Lib/bsddb/dbobj.py	2008-07-23 07:38:42.000000000 -0400
+++ Python-2.6.4/Lib/bsddb/dbobj.py	2009-12-04 07:36:00.000000000 -0500
@@ -110,15 +110,17 @@ class DBEnv:
     def log_stat(self, *args, **kwargs):
         return apply(self._cobj.log_stat, args, kwargs)
 
-    if db.version() >= (4,1):
-        def dbremove(self, *args, **kwargs):
-            return apply(self._cobj.dbremove, args, kwargs)
-        def dbrename(self, *args, **kwargs):
-            return apply(self._cobj.dbrename, args, kwargs)
-        def set_encrypt(self, *args, **kwargs):
-            return apply(self._cobj.set_encrypt, args, kwargs)
+    def dbremove(self, *args, **kwargs):
+        return apply(self._cobj.dbremove, args, kwargs)
+    def dbrename(self, *args, **kwargs):
+        return apply(self._cobj.dbrename, args, kwargs)
+    def set_encrypt(self, *args, **kwargs):
+        return apply(self._cobj.set_encrypt, args, kwargs)
 
     if db.version() >= (4,4):
+        def fileid_reset(self, *args, **kwargs):
+            return self._cobj.fileid_reset(*args, **kwargs)
+
         def lsn_reset(self, *args, **kwargs):
             return apply(self._cobj.lsn_reset, args, kwargs)
 
@@ -229,9 +231,8 @@ class DB(MutableMapping):
     def set_get_returns_none(self, *args, **kwargs):
         return apply(self._cobj.set_get_returns_none, args, kwargs)
 
-    if db.version() >= (4,1):
-        def set_encrypt(self, *args, **kwargs):
-            return apply(self._cobj.set_encrypt, args, kwargs)
+    def set_encrypt(self, *args, **kwargs):
+        return apply(self._cobj.set_encrypt, args, kwargs)
 
 
 class DBSequence:
diff -Nupr Python-2.6.4.orig/Lib/bsddb/dbtables.py Python-2.6.4/Lib/bsddb/dbtables.py
--- Python-2.6.4.orig/Lib/bsddb/dbtables.py	2008-08-31 10:00:51.000000000 -0400
+++ Python-2.6.4/Lib/bsddb/dbtables.py	2009-12-04 07:36:00.000000000 -0500
@@ -15,7 +15,7 @@
 # This provides a simple database table interface built on top of
 # the Python Berkeley DB 3 interface.
 #
-_cvsid = '$Id: dbtables.py 66088 2008-08-31 14:00:51Z jesus.cea $'
+_cvsid = '$Id: dbtables.py 58758 2007-11-01 21:15:36Z gregory.p.smith $'
 
 import re
 import sys
@@ -659,6 +659,13 @@ class bsdTableDB :
             a = atuple[1]
             b = btuple[1]
             if type(a) is type(b):
+
+                # Needed for python 3. "cmp" vanished in 3.0.1
+                def cmp(a, b) :
+                    if a==b : return 0
+                    if a<b : return -1
+                    return 1
+
                 if isinstance(a, PrefixCond) and isinstance(b, PrefixCond):
                     # longest prefix first
                     return cmp(len(b.prefix), len(a.prefix))
diff -Nupr Python-2.6.4.orig/Lib/bsddb/dbutils.py Python-2.6.4/Lib/bsddb/dbutils.py
--- Python-2.6.4.orig/Lib/bsddb/dbutils.py	2008-08-31 10:00:51.000000000 -0400
+++ Python-2.6.4/Lib/bsddb/dbutils.py	2009-12-04 07:36:00.000000000 -0500
@@ -61,7 +61,7 @@ def DeadlockWrap(function, *_args, **_kw
     """
     sleeptime = _deadlock_MinSleepTime
     max_retries = _kwargs.get('max_retries', -1)
-    if _kwargs.has_key('max_retries'):
+    if 'max_retries' in _kwargs:
         del _kwargs['max_retries']
     while True:
         try:
diff -Nupr Python-2.6.4.orig/Lib/bsddb/__init__.py Python-2.6.4/Lib/bsddb/__init__.py
--- Python-2.6.4.orig/Lib/bsddb/__init__.py	2008-09-05 14:33:51.000000000 -0400
+++ Python-2.6.4/Lib/bsddb/__init__.py	2009-12-04 07:36:00.000000000 -0500
@@ -33,7 +33,7 @@
 #----------------------------------------------------------------------
 
 
-"""Support for Berkeley DB 4.0 through 4.7 with a simple interface.
+"""Support for Berkeley DB 4.1 through 4.8 with a simple interface.
 
 For the full featured object oriented interface use the bsddb.db module
 instead.  It mirrors the Oracle Berkeley DB C API.
@@ -42,12 +42,6 @@ instead.  It mirrors the Oracle Berkeley
 import sys
 absolute_import = (sys.version_info[0] >= 3)
 
-if sys.py3kwarning:
-    import warnings
-    warnings.warnpy3k("in 3.x, bsddb has been removed; "
-                      "please use the pybsddb project instead",
-                      DeprecationWarning, 2)
-
 try:
     if __name__ == 'bsddb3':
         # import _pybsddb binary as it should be the more recent version from
@@ -442,8 +436,10 @@ def _checkflag(flag, file):
 # Berkeley DB was too.
 
 try:
-    import thread
-    del thread
+    # 2to3 automatically changes "import thread" to "import _thread"
+    import thread as T
+    del T
+
 except ImportError:
     db.DB_THREAD = 0
 
diff -Nupr Python-2.6.4.orig/Lib/bsddb/test/test_all.py Python-2.6.4/Lib/bsddb/test/test_all.py
--- Python-2.6.4.orig/Lib/bsddb/test/test_all.py	2008-09-03 18:07:11.000000000 -0400
+++ Python-2.6.4/Lib/bsddb/test/test_all.py	2009-12-04 07:36:00.000000000 -0500
@@ -203,6 +203,16 @@ if sys.version_info[0] >= 3 :
                 k = bytes(k, charset)
             return self._db.has_key(k, txn=txn)
 
+        def set_re_delim(self, c) :
+            if isinstance(c, str) :  # We can use a numeric value byte too
+                c = bytes(c, charset)
+            return self._db.set_re_delim(c)
+
+        def set_re_pad(self, c) :
+            if isinstance(c, str) :  # We can use a numeric value byte too
+               c = bytes(c, charset)
+            return self._db.set_re_pad(c)
+
         def put(self, key, value, txn=None, flags=0, dlen=-1, doff=-1) :
             if isinstance(key, str) :
                 key = bytes(key, charset)
@@ -221,6 +231,11 @@ if sys.version_info[0] >= 3 :
                 key = bytes(key, charset)
             return self._db.get_size(key)
 
+        def exists(self, key, *args, **kwargs) :
+            if isinstance(key, str) :
+                key = bytes(key, charset)
+            return self._db.exists(key, *args, **kwargs)
+
         def get(self, key, default="MagicCookie", txn=None, flags=0, dlen=-1, doff=-1) :
             if isinstance(key, str) :
                 key = bytes(key, charset)
@@ -288,13 +303,21 @@ if sys.version_info[0] >= 3 :
                         key = key.decode(charset)
                     data = data.decode(charset)
                     key = self._callback(key, data)
-                    if (key != bsddb._db.DB_DONOTINDEX) and isinstance(key,
-                            str) :
-                        key = bytes(key, charset)
+                    if (key != bsddb._db.DB_DONOTINDEX) :
+                        if isinstance(key, str) :
+                            key = bytes(key, charset)
+                        elif isinstance(key, list) :
+                            key2 = []
+                            for i in key :
+                                if isinstance(i, str) :
+                                    i = bytes(i, charset)
+                                key2.append(i)
+                            key = key2
                     return key
 
             return self._db.associate(secondarydb._db,
-                    associate_callback(callback).callback, flags=flags, txn=txn)
+                    associate_callback(callback).callback, flags=flags,
+                    txn=txn)
 
         def cursor(self, txn=None, flags=0) :
             return cursor_py3k(self._db, txn=txn, flags=flags)
@@ -310,6 +333,12 @@ if sys.version_info[0] >= 3 :
         def __getattr__(self, v) :
             return getattr(self._dbenv, v)
 
+        def get_data_dirs(self) :
+            # Have to use a list comprehension and not
+            # generators, because we are supporting Python 2.3.
+            return tuple(
+                [i.decode(charset) for i in self._dbenv.get_data_dirs()])
+
     class DBSequence_py3k(object) :
         def __init__(self, db, *args, **kwargs) :
             self._db=db
@@ -332,7 +361,10 @@ if sys.version_info[0] >= 3 :
 
     bsddb._db.DBEnv_orig = bsddb._db.DBEnv
     bsddb._db.DB_orig = bsddb._db.DB
-    bsddb._db.DBSequence_orig = bsddb._db.DBSequence
+    if bsddb.db.version() <= (4, 3) :
+        bsddb._db.DBSequence_orig = None
+    else :
+        bsddb._db.DBSequence_orig = bsddb._db.DBSequence
 
     def do_proxy_db_py3k(flag) :
         flag2 = do_proxy_db_py3k.flag
[...3047 lines suppressed...]
     ADD_INT(d, DB_DONOTINDEX);
 
-#if (DBVER >= 41)
-    _addIntToDict(d, "DB_INCOMPLETE", 0);
-#else
-    ADD_INT(d, DB_INCOMPLETE);
-#endif
     ADD_INT(d, DB_KEYEMPTY);
     ADD_INT(d, DB_KEYEXIST);
     ADD_INT(d, DB_LOCK_DEADLOCK);
@@ -7309,14 +8260,15 @@ PyMODINIT_FUNC  PyInit__bsddb(void)    /
     ADD_INT(d, DB_PANIC_ENVIRONMENT);
     ADD_INT(d, DB_NOPANIC);
 
-#if (DBVER >= 41)
     ADD_INT(d, DB_OVERWRITE);
-#endif
 
-#ifdef DB_REGISTER
+#if (DBVER >= 44)
     ADD_INT(d, DB_REGISTER);
 #endif
 
+    ADD_INT(d, DB_EID_INVALID);
+    ADD_INT(d, DB_EID_BROADCAST);
+
 #if (DBVER >= 42)
     ADD_INT(d, DB_TIME_NOTGRANTED);
     ADD_INT(d, DB_TXN_NOT_DURABLE);
@@ -7389,6 +8341,32 @@ PyMODINIT_FUNC  PyInit__bsddb(void)    /
 
     ADD_INT(d, DB_REP_MASTER);
     ADD_INT(d, DB_REP_CLIENT);
+
+    ADD_INT(d, DB_REP_PERMANENT);
+
+#if (DBVER >= 44)
+    ADD_INT(d, DB_REP_CONF_NOAUTOINIT);
+    ADD_INT(d, DB_REP_CONF_DELAYCLIENT);
+    ADD_INT(d, DB_REP_CONF_BULK);
+    ADD_INT(d, DB_REP_CONF_NOWAIT);
+    ADD_INT(d, DB_REP_ANYWHERE);
+    ADD_INT(d, DB_REP_REREQUEST);
+#endif
+
+#if (DBVER >= 42)
+    ADD_INT(d, DB_REP_NOBUFFER);
+#endif
+
+#if (DBVER >= 46)
+    ADD_INT(d, DB_REP_LEASE_EXPIRED);
+    ADD_INT(d, DB_IGNORE_LEASE);
+#endif
+
+#if (DBVER >= 47)
+    ADD_INT(d, DB_REP_CONF_LEASE);
+    ADD_INT(d, DB_REPMGR_CONF_2SITE_STRICT);
+#endif
+
 #if (DBVER >= 45)
     ADD_INT(d, DB_REP_ELECTION);
 
@@ -7400,6 +8378,11 @@ PyMODINIT_FUNC  PyInit__bsddb(void)    /
 #if (DBVER >= 46)
     ADD_INT(d, DB_REP_CHECKPOINT_DELAY);
     ADD_INT(d, DB_REP_FULL_ELECTION_TIMEOUT);
+    ADD_INT(d, DB_REP_LEASE_TIMEOUT);
+#endif
+#if (DBVER >= 47)
+    ADD_INT(d, DB_REP_HEARTBEAT_MONITOR);
+    ADD_INT(d, DB_REP_HEARTBEAT_SEND);
 #endif
 
 #if (DBVER >= 45)
@@ -7412,7 +8395,6 @@ PyMODINIT_FUNC  PyInit__bsddb(void)    /
     ADD_INT(d, DB_REPMGR_ACKS_QUORUM);
     ADD_INT(d, DB_REPMGR_CONNECTED);
     ADD_INT(d, DB_REPMGR_DISCONNECTED);
-    ADD_INT(d, DB_STAT_CLEAR);
     ADD_INT(d, DB_STAT_ALL);
 #endif
 
@@ -7428,12 +8410,16 @@ PyMODINIT_FUNC  PyInit__bsddb(void)    /
     ADD_INT(d, DB_DSYNC_LOG);
 #endif
 
-#if (DBVER >= 41)
     ADD_INT(d, DB_ENCRYPT_AES);
     ADD_INT(d, DB_AUTO_COMMIT);
-#else
-    /* allow Berkeley DB 4.1 aware apps to run on older versions */
-    _addIntToDict(d, "DB_AUTO_COMMIT", 0);
+    ADD_INT(d, DB_PRIORITY_VERY_LOW);
+    ADD_INT(d, DB_PRIORITY_LOW);
+    ADD_INT(d, DB_PRIORITY_DEFAULT);
+    ADD_INT(d, DB_PRIORITY_HIGH);
+    ADD_INT(d, DB_PRIORITY_VERY_HIGH);
+
+#if (DBVER >= 46)
+    ADD_INT(d, DB_PRIORITY_UNCHANGED);
 #endif
 
     ADD_INT(d, EINVAL);
@@ -7497,10 +8483,6 @@ PyMODINIT_FUNC  PyInit__bsddb(void)    /
     }
 #endif
 
-
-#if !INCOMPLETE_IS_WARNING
-    MAKE_EX(DBIncompleteError);
-#endif
     MAKE_EX(DBCursorClosedError);
     MAKE_EX(DBKeyEmptyError);
     MAKE_EX(DBKeyExistError);
@@ -7528,9 +8510,16 @@ PyMODINIT_FUNC  PyInit__bsddb(void)    /
 #if (DBVER >= 42)
     MAKE_EX(DBRepHandleDeadError);
 #endif
+#if (DBVER >= 44)
+    MAKE_EX(DBRepLockoutError);
+#endif
 
     MAKE_EX(DBRepUnavailError);
 
+#if (DBVER >= 46)
+    MAKE_EX(DBRepLeaseExpiredError);
+#endif
+
 #undef MAKE_EX
 
     /* Initiliase the C API structure and add it to the module */
@@ -7544,7 +8533,24 @@ PyMODINIT_FUNC  PyInit__bsddb(void)    /
 #endif
     bsddb_api.makeDBError     = makeDBError;
 
+    /*
+    ** Capsules exist from Python 3.1, but I
+    ** don't want to break the API compatibility
+    ** for already published Python versions.
+    */
+#if (PY_VERSION_HEX < 0x03020000)
     py_api = PyCObject_FromVoidPtr((void*)&bsddb_api, NULL);
+#else
+    {
+        char py_api_name[250];
+
+        strcpy(py_api_name, _bsddbModuleName);
+        strcat(py_api_name, ".api");
+
+        py_api = PyCapsule_New((void*)&bsddb_api, py_api_name, NULL);
+    }
+#endif
+
     PyDict_SetItemString(d, "api", py_api);
     Py_DECREF(py_api);
 
diff -Nupr Python-2.6.4.orig/Modules/bsddb.h Python-2.6.4/Modules/bsddb.h
--- Python-2.6.4.orig/Modules/bsddb.h	2008-09-28 19:24:19.000000000 -0400
+++ Python-2.6.4/Modules/bsddb.h	2009-12-04 07:34:56.000000000 -0500
@@ -105,7 +105,7 @@
 #error "eek! DBVER can't handle minor versions > 9"
 #endif
 
-#define PY_BSDDB_VERSION "4.7.3"
+#define PY_BSDDB_VERSION "4.8.1"
 
 /* Python object definitions */
 
@@ -220,6 +220,7 @@ typedef struct DBSequenceObject {
 /* To access the structure from an external module, use code like the
    following (error checking missed out for clarity):
 
+     // If you are using Python 3.2:
      BSDDB_api* bsddb_api;
      PyObject*  mod;
      PyObject*  cobj;
@@ -231,6 +232,15 @@ typedef struct DBSequenceObject {
      Py_DECREF(cobj);
      Py_DECREF(mod);
 
+
+     // If you are using Python 3.2 or up:
+     BSDDB_api* bsddb_api;
+
+     // Use "bsddb3._pybsddb.api" if you're using
+     // the standalone pybsddb add-on.
+     bsddb_api = (void **)PyCapsule_Import("bsddb._bsddb.api", 1);
+
+
    The structure's members must not be changed.
 */
 
@@ -247,7 +257,6 @@ typedef struct {
 
     /* Functions */
     int (*makeDBError)(int err);
-
 } BSDDB_api;
 
 

python-2.6.4-setup-db48.patch:
 Modules/Setup.dist |    2 +-
 setup.py           |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

--- NEW FILE python-2.6.4-setup-db48.patch ---
diff -up Python-2.6.4/Modules/Setup.dist.setup-db48 Python-2.6.4/Modules/Setup.dist
--- Python-2.6.4/Modules/Setup.dist.setup-db48	2009-12-17 22:05:07.000020150 -0500
+++ Python-2.6.4/Modules/Setup.dist	2009-12-17 22:05:12.545015367 -0500
@@ -411,7 +411,7 @@ gdbm gdbmmodule.c -lgdbm
 #
 # Edit the variables DB and DBLIBVERto point to the db top directory
 # and the subdirectory of PORT where you built it.
-DBLIBVER=4.7
+DBLIBVER=4.8
 DBINC=/usr/include/db4
 DBLIB=/usr/lib
 _bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
diff -up Python-2.6.4/setup.py.setup-db48 Python-2.6.4/setup.py
--- Python-2.6.4/setup.py.setup-db48	2009-12-17 22:03:58.048015993 -0500
+++ Python-2.6.4/setup.py	2009-12-17 22:03:58.169016398 -0500
@@ -705,9 +705,9 @@ class PyBuildExt(build_ext):
         # a release.  Most open source OSes come with one or more
         # versions of BerkeleyDB already installed.
 
-        max_db_ver = (4, 7)
+        max_db_ver = (4, 8)
         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?
 
         def allow_db_ver(db_ver):
             """Returns a boolean if the given BerkeleyDB version is acceptable.


Index: python.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python/devel/python.spec,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -p -r1.155 -r1.156
--- python.spec	12 Nov 2009 19:36:14 -0000	1.155
+++ python.spec	18 Dec 2009 03:20:50 -0000	1.156
@@ -22,7 +22,7 @@
 Summary: An interpreted, interactive, object-oriented programming language
 Name: %{python}
 Version: 2.6.4
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: Python
 Group: Development/Languages
 Provides: python-abi = %{pybasever}
@@ -49,13 +49,24 @@ Patch16: python-2.6-rpath.patch
 # Fix distutils to follow the Fedora/RHEL/CentOS policies of having .pyo files
 Patch51: python-2.6-distutils_rpm.patch
 
+# Automatically disable arena allocator when run under valgrind:
+# From http://bugs.python.org/issue2422
+#   http://bugs.python.org/file9872/disable-pymalloc-on-valgrind-py26.patch
+# with the "configure" part removed; appears to be identical to the version committed to 2.7
+Patch52: disable-pymalloc-on-valgrind-py26.patch
+
+
+# Patch generated by jwboyer at gmail.com to compile against db-4.8, using upstream
+# http://www.jcea.es/programacion/pybsddb.htm
+# See https://bugzilla.redhat.com/show_bug.cgi?id=544275
+Patch53: python-2.6-update-bsddb3-4.8.patch
+# ...and a further patch to setup.py so that it searches for 4.8:
+Patch54: python-2.6.4-setup-db48.patch
+
 # upstreamed
 
 #Patch50: python-2.5-disable-egginfo.patch
 
-# new db version
-#Patch60: python-2.5.2-db47.patch
-
 # lib64 patches
 Patch101: python-2.3.4-lib64-regex.patch
 Patch102: python-2.6-lib64.patch
@@ -93,8 +104,9 @@ BuildRequires: libGL-devel tk tix gcc-c+
 BuildRequires: bzip2 tar /usr/bin/find pkgconfig tcl-devel tk-devel
 BuildRequires: tix-devel bzip2-devel sqlite-devel
 BuildRequires: autoconf
-BuildRequires: db4-devel >= 4.7
+BuildRequires: db4-devel >= 4.8
 BuildRequires: libffi-devel
+BuildRequires: valgrind-devel
 
 URL: http://www.python.org/
 
@@ -211,7 +223,6 @@ code that uses more than just unittest a
 
 # Try not disabling egg-infos, bz#414711
 #patch50 -p1 -b .egginfo
-#%%patch60 -p1 -b .db47
 
 %if "%{_lib}" == "lib64"
 %patch101 -p1 -b .lib64-regex
@@ -227,6 +238,9 @@ code that uses more than just unittest a
 %patch16 -p1 -b .rpath
 
 %patch51 -p1 -b .brprpm
+%patch52 -p0 -b .valgrind
+%patch53 -p1 -b .db48
+%patch54 -p1 -b .setup-db48
 
 %ifarch alpha ia64
 # 64bit, but not lib64 arches need this too...
@@ -256,9 +270,9 @@ if pkg-config openssl ; then
 fi
 # Force CC
 export CC=gcc
-# For patch 4, need to get a newer configure generated out of configure.in
+# For patches 4 and 52, need to get a newer configure generated out of configure.in
 autoconf
-%configure --enable-ipv6 --enable-unicode=%{unicode} --enable-shared --with-system-ffi
+%configure --enable-ipv6 --enable-unicode=%{unicode} --enable-shared --with-system-ffi --with-valgrind
 
 make OPT="$CFLAGS" %{?_smp_mflags}
 LD_LIBRARY_PATH=$topdir $topdir/python Tools/scripts/pathfix.py -i "%{_bindir}/env python%{pybasever}" .
@@ -550,6 +564,15 @@ rm -fr $RPM_BUILD_ROOT
 %{_libdir}/python%{pybasever}/lib-dynload/_testcapimodule.so
 
 %changelog
+* Wed Dec 16 2009 David Malcolm <dmalcolm at redhat.com> - 2.6.4-4
+- automatically disable arena allocator when run under valgrind (upstream
+issue 2422; patch 52)
+- add patch from Josh Boyer containing diff against upstream PyBSDDB to make
+the bsddb module compile against db-4.8 (patch 53, #544275); bump the necessary
+version of db4-devel to 4.8
+- patch setup.py so that it searches for db-4.8, and enable debug output for
+said search; make Setup.dist use db-4.8 (patch 54)
+
 * Thu Nov 12 2009 David Malcolm <dmalcolm at redhat.com> - 2.6.4-3
 - fixup the build when __python_ver is set (Zach Sadecki; bug 533989); use
 pybasever in the files section




More information about the scm-commits mailing list