1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
Index: setup.py
===================================================================
--- misc/build/Python-2.6.1/setup.py (revision 74955)
+++ misc/build/Python-2.6.1/setup.py (working copy)
@@ -695,7 +695,7 @@
# 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?
Index: Modules/_bsddb.c
===================================================================
--- misc/build/Python-2.6.1/Modules/_bsddb.c (revision 74955)
+++ misc/build/Python-2.6.1/Modules/_bsddb.c (working copy)
@@ -215,7 +215,11 @@
#define DB_BUFFER_SMALL ENOMEM
#endif
+#if (DBVER < 48)
+#define DB_GID_SIZE DB_XIDDATASIZE
+#endif
+
/* --------------------------------------------------------------------- */
/* Structure definitions */
@@ -4501,7 +4505,11 @@
DBTxnObject *txn;
#define PREPLIST_LEN 16
DB_PREPLIST preplist[PREPLIST_LEN];
+#if (DBVER < 48)
long retp;
+#else
+ u_int32_t retp;
+#endif
CHECK_ENV_NOT_CLOSED(self);
@@ -4522,7 +4530,7 @@
flags=DB_NEXT; /* Prepare for next loop pass */
for (i=0; i<retp; i++) {
gid=PyBytes_FromStringAndSize((char *)(preplist[i].gid),
- DB_XIDDATASIZE);
+ DB_GID_SIZE);
if (!gid) {
Py_DECREF(list);
return NULL;
@@ -5047,6 +5055,7 @@
}
+#if (DBVER < 48)
static PyObject*
DBEnv_set_rpc_server(DBEnvObject* self, PyObject* args, PyObject* kwargs)
{
@@ -5068,6 +5077,7 @@
RETURN_IF_ERR();
RETURN_NONE();
}
+#endif
static PyObject*
DBEnv_set_verbose(DBEnvObject* self, PyObject* args)
@@ -5947,9 +5957,9 @@
if (!PyArg_ParseTuple(args, "s#:prepare", &gid, &gid_size))
return NULL;
- if (gid_size != DB_XIDDATASIZE) {
+ if (gid_size != DB_GID_SIZE) {
PyErr_SetString(PyExc_TypeError,
- "gid must be DB_XIDDATASIZE bytes long");
+ "gid must be DB_GID_SIZE bytes long");
return NULL;
}
@@ -6539,8 +6549,10 @@
#endif
{"set_get_returns_none",(PyCFunction)DBEnv_set_get_returns_none, METH_VARARGS},
{"txn_recover", (PyCFunction)DBEnv_txn_recover, METH_NOARGS},
+#if (DBVER < 48)
{"set_rpc_server", (PyCFunction)DBEnv_set_rpc_server,
METH_VARARGS||METH_KEYWORDS},
+#endif
{"set_verbose", (PyCFunction)DBEnv_set_verbose, METH_VARARGS},
#if (DBVER >= 42)
{"get_verbose", (PyCFunction)DBEnv_get_verbose, METH_VARARGS},
@@ -7089,6 +7101,7 @@
ADD_INT(d, DB_MAX_PAGES);
ADD_INT(d, DB_MAX_RECORDS);
+#if (DBVER < 48)
#if (DBVER >= 42)
ADD_INT(d, DB_RPCCLIENT);
#else
@@ -7096,7 +7109,11 @@
/* allow apps to be written using DB_RPCCLIENT on older Berkeley DB */
_addIntToDict(d, "DB_RPCCLIENT", DB_CLIENT);
#endif
+#endif
+
+#if (DBVER < 48)
ADD_INT(d, DB_XA_CREATE);
+#endif
ADD_INT(d, DB_CREATE);
ADD_INT(d, DB_NOMMAP);
@@ -7113,7 +7130,13 @@
ADD_INT(d, DB_INIT_TXN);
ADD_INT(d, DB_JOINENV);
+#if (DBVER >= 48)
+ ADD_INT(d, DB_GID_SIZE);
+#else
ADD_INT(d, DB_XIDDATASIZE);
+ /* Allow new code to work in old BDB releases */
+ _addIntToDict(d, "DB_GID_SIZE", DB_XIDDATASIZE);
+#endif
ADD_INT(d, DB_RECOVER);
ADD_INT(d, DB_RECOVER_FATAL);
--- misc/build/Python-2.6.1/Lib/bsddb/test/test_distributed_transactions.py~ 2008-08-31 16:00:51.000000000 +0200
+++ misc/build/Python-2.6.1/Lib/bsddb/test/test_distributed_transactions.py 2010-03-14 21:36:19.762842468 +0100
@@ -35,7 +35,7 @@
db.DB_INIT_TXN | db.DB_INIT_LOG | db.DB_INIT_MPOOL |
db.DB_INIT_LOCK, 0666)
self.db = db.DB(self.dbenv)
- self.db.set_re_len(db.DB_XIDDATASIZE)
+ self.db.set_re_len(db.DB_GID_SIZE)
if must_open_db :
if db.version() > (4,1) :
txn=self.dbenv.txn_begin()
@@ -76,7 +76,7 @@
# let them be garbage collected.
for i in xrange(self.num_txns) :
txn = self.dbenv.txn_begin()
- gid = "%%%dd" %db.DB_XIDDATASIZE
+ gid = "%%%dd" %db.DB_GID_SIZE
gid = adapt(gid %i)
self.db.put(i, gid, txn=txn, flags=db.DB_APPEND)
txns.add(gid)
--- misc/build/Python-2.6.1/Lib/bsddb/test/test_basics.py~ 2009-07-02 17:37:21.000000000 +0200
+++ misc/build/Python-2.6.1/Lib/bsddb/test/test_basics.py 2010-03-14 21:33:00.077842066 +0100
@@ -1032,11 +1032,12 @@
# # See http://bugs.python.org/issue3307
# self.assertRaises(db.DBInvalidArgError, db.DB, None, 65535)
- def test02_DBEnv_dealloc(self):
- # http://bugs.python.org/issue3885
- import gc
- self.assertRaises(db.DBInvalidArgError, db.DBEnv, ~db.DB_RPCCLIENT)
- gc.collect()
+ if db.version() < (4, 8) :
+ def test02_DBEnv_dealloc(self):
+ # http://bugs.python.org/issue3885
+ import gc
+ self.assertRaises(db.DBInvalidArgError, db.DBEnv, ~db.DB_RPCCLIENT)
+ gc.collect()
#----------------------------------------------------------------------
|